Tao.Sdl SDK Documentation

SdlNet.SDLNet_UDP_AddSocket Method 

Add a socket to a socket set

[Visual Basic]
Public Shared Function SDLNet_UDP_AddSocket( _
   ByVal set As SDLNet_SocketSet, _
   ByVal sock As IntPtr _
) As Integer
[C#]
public static int SDLNet_UDP_AddSocket(
   SDLNet_SocketSet set,
   IntPtr sock
);

Parameters

set
The socket set to add this socket to
sock
The socket to add to the socket set

Return Value

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

Remarks

Add a socket to a socket set that will be watched.

Binds to C-function call in SDL_net.h:

            #define SDLNet_UDP_AddSocket(set, sock) SDLNet_AddSocket(set, (SDLNet_GenericSocket)sock)
            

Example

            // 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

SdlNet Class | Tao.Sdl Namespace | SDLNet_AllocSocketSet | SDLNet_DelSocket | SDLNet_CheckSockets | SdlNet.SDLNet_SocketSet | SdlNet.UDPsocket | SdlNet.TCPsocket