SDLNet_UDP_SendV

Name

SDLNet_UDP_SendV -- send a UDP packet vector.

Synopsis

int SDLNet_UDP_SendV(UDPsocket sock, UDPpacket **packetV, int npackets)

sock A valid UDPsocket.

packetV The vector of packets to send.

npackets Number of packets in the packetV vector to send.

Description

Send npackets of packetV using the specified sock socket.

Each packet is sent in the same way as in SDLNet_UDP_Send (see SDLNet_UDP_Send).

Don't forget to set the length of the packets in the len element of the packets you are sending!

Return Value

Returns: The number of destinations sent to that worked, for each packet in the vector, all summed up. 0 is returned on errors.

Example

// send a vector of 10 packets using UDPsocket
//UDPsocket udpsock;
//UDPpacket **packetV;
int numsent;

numsent=SDLNet_UDP_SendV(udpsock, packetV, 10);
if(!numsent) {
    printf("SDLNet_UDP_SendV: %s\n", SDLNet_GetError());
    // do something because we failed to send
    // this may just be because no addresses are bound to the channels...
}

See Also

SDLNet_UDP_Bind, SDLNet_UDP_Send, SDLNet_UDP_Recv, SDLNet_UDP_RecvV, UDPpacket, UDPsocket

SDLNet_UDP_SendV (last edited 2008-04-17 08:18:53 by localhost)