UDP is a network protocol that is faster and less rigid in its packet transmission requirements. Unlike TCP, UDP has no notion of connections nor does it check to see if a packet has been successfuly recieved by the client. A UDP socket can receive datagrams from any server on the network and send datagrams to any host on the network. In addition, datagrams may arrive in any order, never arrive at all, or be duplicated in transit. There are three modes of UDP servers: socket (aka unicast), broadcast, and multicast.

Unicast refers to a unique host-client. This is a one-to one connection between the client and the server

Multicast is the delivery of a message or information to a group of destination computers simultaneously in a single transmission. A packet sent to a unicast or broadcast address is only delivered to the host identified by that address. To the contrary, when packet is send to a multicast address, all interfaces identified by that address receive the data. However, multicast has the drawback that it is not well supported by routers and NAT.

Broadcast allows you to call every host within a subnet. It's like Multicast but doesn't require that your network infrastructure support it.

UDP Socket Client (receiving):
1) Create() - intialize the client
2) Bind() - bind the client to a port and listen for any UDP messages on that port
3) Receive() - receive any data broadcast over UDP on the port set up to receive on

The basic usage of UDP for multicast looks like so:

UDP Multicast (sending):
1) Create() - initialize the server
2) ConnectMcast() - connect to an IP and a Port that you'll broadcast on
3) Send() - send a message to any listening clients

UDP Multicast (receiving):
1) Create() - initialize the client
2) BindMcast() - bind to a port
3) Receive() - check to see if any data has been received

int ofxUDPManager::SendAll(const char *pBuff, const int iSize)

bool ofxUDPManager::SetEnableBroadcast(bool enableBroadcast)

Broadcast allows sending of packets to a particular network layer. If you're only using a single local network without a large number of attached machines, using broadcast may make more sense than trying to use multicast.

bool ofxUDPManager::SetNonBlocking(bool useNonBlocking)

Determines whether calls to send or receive are allowed to block their thread until they've completed. If your network infrastructure is time critical, then this may be a good choice. Usually though, you should leave it off.

bool ofxUDPManager::SetSendBufferSize(int sizeInByte)

bool ofxUDPManager::SetTTL(int nTTL)

The TTL (Time To Live) field in the IP header has a double significance in multicast. As always, it controls the live time of the datagram to avoid it being looped forever due to routing errors. Routers decrement the TTL of every datagram as it traverses from one network to another and when its value reaches 0 the packet is dropped.

A list of TTL thresholds and their associated scope follows:

TTL Scope

0 Restricted to the same host. Won't be output by any interface.
1 Restricted to the same subnet. Won't be forwarded by a router.
<32 Restricted to the same site, organization or department.
<64 Restricted to the same region.
<128 Restricted to the same continent.
<255 Unrestricted in scope. Global.