Multicast Datagram ServerClient Design

 < Day Day Up > 



Multicast Datagram Server/Client Design

The multicast datagram server and client utilize a UDP connection to communicate the date and time information from the multicast server to the client. As in the case of the broadcast server, because communication is multicast, there is no physical connection between the client and server. The client is only required to subscribe to the multicast address and port in order to receive the multicast datagrams. The server may send multicast datagrams without any real configuration. The client must configure itself for membership within the multicast group in order to receive the multicast datagrams. The data flow diagram illustrating the Sockets API calls for the multicast client and server is shown in Figure 15.4.

click to expand
Figure 15.4: Multicast datagram server/client data flow.

The server begins by creating a socket and an associated name structure that is used to direct the datagrams. The client is a bit more complicated. After the client socket is created, the SO_REUSEADDR socket option is used to allow the client to bind the multicast address and port number without the potential “port in use” error. The name information is then bound to the socket (multicast group address and port). Finally, the multicast client must join the multicast group in order to receive multicast datagrams. This is done using the IP_ADD_MEMBERSHIP socket option, referencing the multicast group address.

The server sends the date and time information to the client using the sendto API function. In order to direct the datagrams to the multicast group, the predefined group address and port number are specified within the sendto call. Receiving the multicast datagrams is provided by the recvfrom API function at the client.



 < Day Day Up > 



BSD Sockets Programming from a Multi-Language Perspective
Network Programming for Microsoft Windows , Second Edition (Microsoft Programming Series)
ISBN: 1584502681
EAN: 2147483647
Year: 2003
Pages: 225
Authors: Jim Ohlund

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net