You should buy this book:
http://www.kohala.com/start/unpv22e/unpv22e.html
Also on that page, is a link to the source code provided in the book. You should hopefully be able to find your answers there.
P.S. An example of a broadcaster and a receiver
Code:
#include <Socket/UDPSocket.h>
int main()
{
socketpp::UDPSocket sock;
sock.EnableBroadcast();
sock.Send("hello world", 11, "255.255.255.255", 8000);
}
Code:
#include <Socket/UDPSocket.h>
#include <iostream>
int main()
{
socketpp::UDPSocket sock;
sock.Bind(8000);
char msg[80] = {0};
sock.Recv(msg, sizeof(msg) - 1);
std::cout << msg << std::endl;
}