Jump to content

User:RossyMiles/Flatline: Difference between revisions

No edit summary
Line 42: Line 42:
These functions provide a basic, single-threaded, blocking UDP server.
These functions provide a basic, single-threaded, blocking UDP server.


int '''NetUDPServer_Run('''uint16_t '''port''', bool (*'''packet_callback''')'''('''char* '''data''', uint16_t '''datalen''', int '''from))'''<br>
int '''NetUDPServer_Listen('''uint16_t '''port''', bool (*'''packet_callback''')'''('''char* '''data''', uint16_t '''datalen''', int '''from))'''<br>
Starts a new UDP server on the specified port which calls '''packet_callback''' when a packet is recieved. Does not return until the server has finished running ('''packet_callback''' returns false).
Starts a new UDP server on the specified port which calls '''packet_callback''' when a packet is recieved. Does not return until the server has finished running ('''packet_callback''' returns false).


bool '''NetUDPServer_Send('''sockaddr* '''address''', const char* '''data''', uint16_t '''datalen)'''<br>
bool '''NetUDPServer_Send('''sockaddr* '''address''', const char* '''data''', uint16_t '''datalen)'''<br>
Sends a packet of data to the specified address using the server running on the current thread. This function should only be called from '''packet_callback''' or functions called by '''packet_callback'''.
Sends a packet of data to the specified address using the server running on the current thread. This function should only be called from '''packet_callback''' or functions called by '''packet_callback'''.
98

edits