3.6.3 SDLNet_AddSocket
int SDLNet_AddSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock)
int SDLNet_TCP_AddSocket(SDLNet_SocketSet set, TCPsocket sock)
int SDLNet_UDP_AddSocket(SDLNet_SocketSet set, UDPsocket sock)
- set
- The socket set to add this socket to
- sock
- the socket to add to the socket set
Add a socket to a socket set that will be watched.
Returns: the number of sockets used in the set on success.
-1 is returned on errors.
| | // add two sockets to a socket set
//SDLNet_SocketSet set;
//UDPsocket udpsock;
//TCPsocket tcpsock;
int numused;
numused=SDLNet_UDP_AddSocket(set,udpsock);
if(numused==-1) {
printf("SDLNet_AddSocket: %s\n", SDLNet_GetError());
// perhaps you need to restart the set and make it bigger...
}
numused=SDLNet_TCP_AddSocket(set,tcpsock);
if(numused==-1) {
printf("SDLNet_AddSocket: %s\n", SDLNet_GetError());
// perhaps you need to restart the set and make it bigger...
}
|
|
See Also:
3.6.1 SDLNet_AllocSocketSet,
3.6.4 SDLNet_DelSocket,
3.6.5 SDLNet_CheckSockets,
4.5 SDLNet_SocketSet,
4.3 UDPsocket,
4.2 TCPsocket
This document was generated
on August, 6 2004
using texi2html