SDLNet_UDP_RecvV
Name
SDLNet_UDP_RecvV -- recieve a UDP packet vector.
Synopsis
int SDLNet_UDP_RecvV(UDPsocket sock, UDPpacket **packetV)
sock A valid UDPsocket.
packet The packet to receive into.
Description
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.
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_UDP_Bind, SDLNet_UDP_Send, SDLNet_UDP_SendV, SDLNet_UDP_Recv, UDPpacket, UDPsocket
