Skip to content

Networking Functions

Chris Feger edited this page Feb 20, 2020 · 3 revisions
char* net_ip();

Returns the IP address of your 3DS as a string

  • This string SHOULD NOT be freed
int net_udp_recv(char* buffer, int size, int* received);
int net_tcp_recv(char* buffer, int size, int* received);

Receives data (such as pkx, WC, etc.) sent from a client running on another device

  • char* buffer: pointer to an existing char Array to hold the data being received
  • int size: expected number of bytes
  • int* received: pointer to an existing int variable to hold the number of received bytes
  • returns 0 if data was successfully received (scripts will need to check the validity of the received data themselves)
int net_tcp_send(char* ip, int port, char* buffer, int size);

Sends data to a compatible client on another device

  • char* ip: IP address of device to send data to
  • int port: port on device to send data to
  • char* buffer: data to send
  • int size: size of data being sent, in bytes
  • returns 0 if successful
int fetch_web_content(char** out, int* outSize, char* url);

Performs an HTTP GET request

  • char** out: *out is set to a pointer to the downloaded data on success. *out must be manually freed. Set to NULL on error.
  • int* outSize: *outSize is set to the size of the data stored in *out
  • char* url: URL from which to download the data
  • return value: negative for cURL errors, otherwise the HTTP response code

Added after v8.0.3