Infrasctucture UdpSrv Function Reference
UdpSrv
#include "tcpSrv.h"
The UdpSrv module allows the programmer to create a UDP server or, in the interest of symmetry, connect to another process running the UDP protocol.   The UDP packets usually contain binary information.   The UdpSrv paradigm is, a usOpen() followed by a usSnd() and/or usRcv() and finally usClose().  

usClose usInit usOpen usRcv usSnd

int usClose( int handle )
Close all sockets and clean up.
Returns OK.


int usInit( int argc, char** argv )
Prepares UdpSrv for initialiazation.
Returns argc.


int usOpen( char* host, char* port, int maxDat, int srvFlg )
Create control block, with input and output buffers, a base socket with host and port assigned.   If srvFlg is TRUE, bind a name to the socket.
Returns a handle for use with all following operations on this socket else negative of errno.


int usRcv( int handle, char* rcvDat, int maxRx, int to, int rrFlg )
Receive characters until either the character count reaches "maxRx" or the time out "to" expires.   Returns bytes received or an error (negative of errno) or zero if timed out.   If the ReRead flag ("rrFlg") is TRUE, do not flush the packet, so It may be re-read.   This is handy when you want to read the header of a packet and later read the body.


int usSnd( int handle, int to, int txLen, uchar* txDat )
Transmit the characters indicated by "txDat" and of length "txLen".   If the socket is not yet connected, it will be connected to the previously indicated host and port (tsOpen()).  
Returns bytes transmitted or an error (negative of errno) or zero if timed out.