Tao.Sdl SDK Documentation

SdlNet.SDLNet_UDP_RecvV Method 

Receive into a UDPpacket vector

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

Parameters

sock
A valid UDPsocket.
packets
The packet vector to receive into.

Return Value

the number of packets received. 0 is returned when no packets are received. -1 is returned on errors.

Remarks

Receive into a packet vector on the specified socket sock. packetV is a NULL terminated array. Packets will be received until the NULL is reached, or there are none ready to be received. This call is otherwise the same as SDLNet_UDP_Recv

Binds to C-function call in SDL_net.h:

                extern DECLSPEC int SDLCALL SDLNet_UDP_RecvV(UDPsocket sock, UDPpacket **packets)
            

Example

            // try to receive some waiting udp packets
            //UDPsocket udpsock;
            //UDPpacket **packetV;
            int numrecv, i;
            numrecv=SDLNet_UDP_RecvV(udpsock, &packetV);
            if(numrecv==-1) {
            // handle error, perhaps just print out the SDL_GetError string.
            }
            for(i=0; i<numrecv; i++) {
            // do something with packetV[i]
            }
            

See Also

SdlNet Class | Tao.Sdl Namespace | SDLNet_UDP_Bind | SDLNet_UDP_Send | SDLNet_UDP_SendV | SDLNet_UDP_Recv | SdlNet.UDPpacket | SdlNet.UDPsocket