[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.6.4 SDLNet_DelSocket

int SDLNet_DelSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock)
int SDLNet_TCP_DelSocket(SDLNet_SocketSet set, TCPsocket sock)
int SDLNet_UDP_DelSocket(SDLNet_SocketSet set, UDPsocket sock)

set
The socket set to remove this socket from
sock
the socket to remove from the socket set

Remove a socket from a socket set. Use this before closing a socket that you are watching with a socket set. This doesn't close the socket. Call the appropriate macro for TCP or UDP sockets. The generic socket function will be called by the TCP and UDP macros.

Returns: the number of sockets used in the set on success. -1 is returned on errors.

 
// remove two sockets from a socket set
//SDLNet_SocketSet set;
//UDPsocket udpsock;
//TCPsocket tcpsock;
int numused;

numused=SDLNet_UDP_DelSocket(set,udpsock);
if(numused==-1) {
    printf("SDLNet_DelSocket: %s\n", SDLNet_GetError());
    // perhaps the socket is not in the set
}
numused=SDLNet_TCP_DelSocket(set,tcpsock);
if(numused==-1) {
    printf("SDLNet_DelSocket: %s\n", SDLNet_GetError());
    // perhaps the socket is not in the set
}

See Also:
3.6.3 SDLNet_AddSocket, 3.6.2 SDLNet_FreeSocketSet, 4.5 SDLNet_SocketSet, 4.3 UDPsocket, 4.2 TCPsocket



This document was generated on November, 3 2009 using texi2html