3.4 UDP Sockets
These functions are used to work with UDP Sockets.
UDP is connectionless, but can be used as if it is connected, in the sense that you
don't have to address every outgoing packet if you don't want to. This is done by
binding a socket to remote IP address and port pairs.
UDP has no delivery guarantees, each packet has a chance of never getting to the
destination.
UDP packets may also be received completely out of order, as compared to the order
of sending them.
All these seeming bad qualities are made up for in speed. UDP is faster than TCP, and so
many games and speed sensitive applications, which may also be sending redundant data
anyways, such as a game state, prefer to use UDP for the speed benefits.
SDL_net has a concept of channels, which help you to matchup packets to specific clients easier. These channel numbers are not transmitted in the UDP packet data, but rather when a UDP socket receives or sends packets, a channel number may be used instead of an IPaddress to refer to the source or destination. You might prefer not to use channels at all, which is fine. SDL_net provides them only as an optional convenience.
General
Channel Binding
Single UDPpacket
Many UDPpackets in a vector (array)
This document was generated
on November, 3 2009
using texi2html