[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.9 SDLNet_UDP_RecvV

int SDLNet_UDP_RecvV(UDPsocket sock, UDPpacket **packetV)

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

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 (see section 3.4.7 SDLNet_UDP_Recv).

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

 
// 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:
3.4.3 SDLNet_UDP_Bind, 3.4.6 SDLNet_UDP_Send, 3.4.8 SDLNet_UDP_SendV, 3.4.7 SDLNet_UDP_Recv, 4.4 UDPpacket, 4.3 UDPsocket



This document was generated on November, 3 2009 using texi2html