Tao.Sdl SDK Documentation

SdlNet.SDLNet_AllocSocketSet Method 

Create a new socket set

[Visual Basic]
Public Shared Function SDLNet_AllocSocketSet( _
   ByVal maxsockets As Integer _
) As SDLNet_SocketSet
[C#]
public static SDLNet_SocketSet SDLNet_AllocSocketSet(
   int maxsockets
);

Parameters

maxsockets
The maximum number of sockets you will want to watch.

Return Value

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

Remarks

Create 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.

Binds to C-function call in SDL_net.h:

            extern DECLSPEC SDLNet_SocketSet SDLCALL SDLNet_AllocSocketSet(int maxsockets)
            

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 Class | Tao.Sdl Namespace | SDLNet_FreeSocketSet | SDLNet_AddSocket | SdlNet.SDLNet_SocketSet | SdlNet.UDPsocket | SdlNet.TCPsocket