ConnexRead
Syntax | ||
int ConnexRead(int num,int *sock,unsigned char **buffer,int *size,int *flag, struct timeval *tmout); | ||
Header | ||
base/connex.h | ||
Library | ||
cnx | ||
Description | ||
The The number of open streams to process is given by the argument num. The socket file descriptors are given by the array pointed to by the argument sock. If a data packet can be read from a socket then memory is allocated to store the decoded data. The pointer to the memory buffer is stored in the appropriate element of the array pointed to by the argument buffer. The number of bytes of data read is stored in the appropriate element of the array pointed to by the argument size. The argument flag points to an array that stores a status flag for each stream; if data was received then the flag is set to (1), if no data was received then the flag is set to zero, if an error occurred then the flag is set to (-1). The final argument tmout is a pointer to a timeout structure that indicates how long the function should block until control is returned. If this argument is set to NULL then the function will block indefinitely until data is received on one of the connections. The memory buffers allocated by the function should be freed when they are no longer required. | ||
Returns | ||
Returns the number of sockets that data has been read from on success. On error, (-1) is returned. | ||
Errors | ||
On error, (-1) is returned. | ||
Example | ||
|