SDL Wiki
(This function is part of SDL_net, a separate library from SDL.)

SDLNet_UDP_RecvV

Receive a vector of pending packets from a UDP socket.

Syntax

int SDLNet_UDP_RecvV(UDPsocket sock, UDPpacket **packets);

Function Parameters

sock the UDP socket to receive packets on.
packets an array of packets, NULL terminated.

Return Value

Returns the number of packets read from the network, or -1 on error. 0 means no packets were currently available.

Remarks

The returned packets contain the source address and the channel they arrived on. If they did not arrive on a bound channel, the the channel will be set to -1.

The channels are checked in highest to lowest order, so if an address is bound to multiple channels, the highest channel with the source address bound will be returned.

This function takes an array of packets but does not need to be allocated through SDLNet_AllocPacketV; if you supply your own array of packets you allocated individually, that is okay, as long as the last element in the array is NULL, so SDL_net knows the array bounds. The arrays returned by SDLNet_AllocPacketV are properly NULL-terminated for these purposes.

This function does not block, so it can return 0 packets pending, which is not an error condition.

Version

This function is available since SDL_net 2.0.0.


CategoryAPI


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.