98
edits
RossyMiles (talk | contribs) mNo edit summary |
RossyMiles (talk | contribs) mNo edit summary |
||
Line 18: | Line 18: | ||
These functions provide basic automatic port forwarding for computers behind a router. | These functions provide basic automatic port forwarding for computers behind a router. | ||
bool '''NetUPnP_Initalize'''(char** '''localip''', char** '''routerip''') | bool '''NetUPnP_Initalize'''(char** '''localip''', char** '''routerip''')<br> | ||
Initializes the UPnP library. Places the local ip address in localip and places the router's ip address in routerip. | Initializes the UPnP library. Places the local ip address in localip and places the router's ip address in routerip. | ||
bool '''NetUPnP_Shutdown'''() | bool '''NetUPnP_Shutdown'''()<br> | ||
Closes the | Closes the UPnP library. Frees the strings pointed to by localip and routerip. | ||
=== NetUDPSocket_* === | === NetUDPSocket_* === | ||
These functions provide a basic UDP sockets library. | |||
int '''NetUDPSocket_Create'''(uint16_t '''port''')<br> | int '''NetUDPSocket_Create'''(uint16_t '''port''')<br> | ||
Creates a new, non-blocking, UDP socket and binds it to the port specified. If the specified port is 0, the socket is automatically bound to an unused port. | Creates a new, non-blocking, UDP socket and binds it to the port specified. If the specified port is 0, the socket is automatically bound to an unused port. | ||
Line 32: | Line 34: | ||
bool '''NetUDPSocket_Send'''(int '''socket''', sockaddr_in/sockaddr_in6 '''address''', const char* '''data''', uint16_t '''datalen''')<br> | bool '''NetUDPSocket_Send'''(int '''socket''', sockaddr_in/sockaddr_in6 '''address''', const char* '''data''', uint16_t '''datalen''')<br> | ||
Sends a packet of data to the specified address using the specified socket. | Sends a packet of data to the specified address using the specified socket. To broadcast a message across a LAN (such as when checking for available games), send it to 255.255.255.255 (IPv4 only). | ||
bool '''NetUDPSocket_Recieve'''(int '''socket''', char* '''data''', uint16_t* '''datalen''', sockaddr_in*/sockaddr_in6* '''address''')<br> | bool '''NetUDPSocket_Recieve'''(int '''socket''', char* '''data''', uint16_t* '''datalen''', sockaddr_in*/sockaddr_in6* '''address''')<br> | ||
Recieves a single packet from the specified socket. Places the received data in "data", the length of the data returned in datalen, and the address the packet was received from in address. If there are no packets in the buffer, the function returns immediately. | Recieves a single packet from the specified socket. Places the received data in "data", the length of the data returned in datalen, and the address the packet was received from in address. If there are no packets in the buffer, the function returns immediately. |
edits