broadcasting

  • Follow


hi
i m working on a client-server kind of model. i wish the client to be
able to broadcast a message to all the systems on the lan ( suppose
that every system on the lan is running the server ) and get the ip
address back from all the systems.  how could i do this ?

any kind of assistance would be appreciated.

0
Reply manishmodgil (53) 1/16/2006 10:26:36 AM

manish wrote:
> hi
> i m working on a client-server kind of model. i wish the client to be
> able to broadcast a message to all the systems on the lan ( suppose
> that every system on the lan is running the server ) and get the ip
> address back from all the systems.  how could i do this ?

Your client broadcasts or multicasts a UDP datagram. Your servers
receive the datagram and respond to the sender of it with another
datagram. The client receives server responses obtaining servers'
addresses either from datagram source address or from its contents.

0
Reply Maxim 1/16/2006 10:46:52 AM


how could i broadcast a message..which particular method to use . can i
do it using the send and reciev routines.

0
Reply manish 1/16/2006 10:52:52 AM

manish wrote:
> how could i broadcast a message..which particular method to use .

Just send a datagram to a broadcast or a multicast address as you would
do for a unicast address.

> can i do it using the send and reciev routines.

To be able to receive broadcast datagrams you have to set SO_BROADCAST
option. To be able to receive multicast datagrams you have to join the
multicast group on your interface via IP_ADD_MEMBERSHIP and then
recieve datagrams as you would do for unicast.

http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Multicast-HOWTO.html#ss2.3

0
Reply Maxim 1/16/2006 11:47:52 AM

In article <1137408772.006797.23450@g43g2000cwa.googlegroups.com>,
 "manish" <manishmodgil@gmail.com> wrote:

> how could i broadcast a message..which particular method to use . can i
> do it using the send and reciev routines.

Read the chapter on broadcasting in Unix Network Programming, Vol.1, by 
W. Richard Stevens.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
0
Reply Barry 1/17/2006 2:35:19 AM

4 Replies
244 Views

(page loaded in 0.496 seconds)

Similiar Articles:













7/28/2012 9:45:33 PM


Reply: