SDLNet_UDP_RecvV -- recieve a UDP packet vector.


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.

Return Value

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

SDLNet_UDP_Bind, SDLNet_UDP_Send, SDLNet_UDP_SendV, SDLNet_UDP_Recv, UDPpacket, UDPsocket

SDLNet_UDP_RecvV (last edited 2008-04-17 08:18:12 by localhost)