User`s guide

212
K
A
DAK
KwikNet TCP/IP Sockets
Description ...continued
Timeout is a pointer to a structure which defines the interval for which the
caller is prepared to wait for at least one socket to meet the selected
criteria. The timing resolution is determined by the
KwikNet clock
frequency. Set timeout to NULL to wait forever. Set the interval value
to 0 to return immediately if no sockets are ready. If the specified
timeout interval is less than one millisecond, the procedure will return
immediately with a timeout indication if no sockets are ready.
Structure timeval is described in file KN_SOCK.H as follows:
struct timeval {
unsigned long tv_sec; /* Number of seconds */
unsigned long tv_usec; /* Number of microseconds */
};
Type fd_set is defined by a typedef in Treck file TRSOCKET.H.
Variables of type fd_set can be manipulated using the following
macros which are defined in Treck file TRSOCKET.H. In the
descriptions which follow, fdset is a variable of type fd_set and s is
a valid socket descriptor.
FD_SET(s, &fdset) Set socket s identifier in variable fdset.
FD_CLR(s, &fdset) Clear socket s identifier in variable fdset.
FD_ISSET(s, &fdset) Test socket s identifier in variable fdset.
FD_ZERO(&fdset) Clear all socket identifiers in variable fdset.
Use FD_ZERO to reset (clear) all socket identifiers in a descriptor set.
Use FD_SET to identify the specific sockets to be interrogated.
FD_ISSET returns a non-zero value if the identifier for socket s is set or
zero if the identifier for socket
s is clear.
The behavior of these macros is undefined if the socket descriptor s is
invalid.
Note that the structure and parameter names are derived from UNIX for
which this procedure interrogates both files and sockets.
...more