SDLNet_DelSocket
Name
SDLNet_DelSocket -- remove a socket from a socket set.
Synopsis
#include "SDL_net.h" 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 is the socket set to remove this socket from.
sock is the socket to remove from the socket set.
Description
SDLNet_DelSocket removes 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.
Return Value
Returns the number of sockets used in the set on success. -1 is returned on errors.
Example
// 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
SDLNet_AddSocket, SDLNet_FreeSocketSet, SDLNet_SocketSet, UDPsocket, TCPsocket
