I am writing a client/server application using sockets on Linux
platform. I am using UDP/IP protocol. The server broadcasts message for
interval of time. I can run this server on any machine.
I have used "setsockopt" function with level "SOL_SOCKET" and optname as
"SO_BROADCAST". I am using the broadcast address as "255.255.255.255".
I am using "sendto" to send this address.
I want to know how to receive the packet sent by this at the client
running on another machine. I will not know the server address, but i
have set the server and client port numbers as 2000 and 2001
I want to send a broadcast packet from the server to all the clients
who are listening at port 2000 and they should receive the packet sent
by the server at port 2001.
Should i explicitly set up the ports using some functions?
I am referring W. Richard Stevens "Unix Network Programming". There is
no example that uses broadcasting.