Hello ,
I am writing a client/server application using sockets on Linux
platform. I am using UDP/IP socket. The server broadcasts message for
every 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" to enable the server to send message to all the
clients
over the network. I am using the broadcast address as
"255.255.255.255".I
am doing "sendto" to send to 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
respectively.
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.
Right now, At the server side i am getting an error "Send to:
permission denied"
I would be thankful to you if you can help me out in this case,
Thanks in advance,
Regards,
RK Patil