SDLNet_AllocSocketSet

Name

SDLNet_AllocSocketSet -- create a socket set that will be able to watch up to a given amount of sockets.

Synopsis

#include "SDL_net.h"

SDLNet_SocketSet SDLNet_AllocSocketSet(int maxsockets);

maxsockets is the maximum number of sockets you will want to watch.

Description

SDLNet_AllocSocketSet creates a socket set that will be able to watch up to maxsockets number of sockets. The same socket set can be used for both UDP and TCP sockets.

Return Value

Returns a new, empty, SDLNet_SocketSet. NULL is returned on errors, such as out-of-memory.

Example

// Create a socket set to handle up to 16 sockets
SDLNet_SocketSet set;

set = SDLNet_AllocSocketSet(16);
if (!set) {
    printf("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError());
    exit(1); //most of the time this is a major error, but do what you want.
}

See Also

SDLNet_FreeSocketSet, SDLNet_AddSocket, SDLNet_SocketSet, UDPsocket, TCPsocket

SDLNet_AllocSocketSet (last edited 2008-04-17 08:18:44 by localhost)