User:RossyMiles/Flatline: Difference between revisions

no edit summary
mNo edit summary
No edit summary
Line 7: Line 7:


=== NetPlatform_* ===
=== NetPlatform_* ===
These functions provide all the platform specific functionality required by Net*.
bool '''NetPlatform_Initalize'''()<br>
bool '''NetPlatform_Initalize'''()<br>
This function is called when the network functionality is required. On Windows, it makes a call to WSAStartup.
This function is called when the network functionality is required. On Windows, it makes a call to WSAStartup.


bool '''NetPlatform_Shutdown'''()<br>
void '''NetPlatform_Shutdown'''()<br>
For every call to NetPlatform_Initalize, there has to be a corresponsing call to NetPlatform_Shutdown. On Windows, this function calls WSACleanup.
For every call to NetPlatform_Initalize, there has to be a corresponsing call to NetPlatform_Shutdown. On Windows, this function calls WSACleanup.
=== NetUPnP ===
These functions provide basic automatic port forwarding for computers behind a router.
bool '''NetUPnP_Initalize'''(char** localip, char** routerip)
Initializes the UPnP library. Places the local ip address in localip and places the router's ip address in routerip.
bool '''NetUPnP_Shutdown'''()
Closes the NetUPnP library. Frees the strings pointed to by localip and routerip.


=== NetUDPSocket_* ===
=== NetUDPSocket_* ===
Line 24: Line 35:


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.
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.
98

edits