Alex Rivera | Logout

How to broadcast a message in a network?

Asked 2010-02-27T13:12:23.023
13

I'm working on a client-server application written in C. I want to broadcast a message to all the machines available on the local network.

How can I do that using the usual socket system calls in C?

Edit
Report

2 Answers

10

Just send the message to the broadcast address of your subnet, which for 192.168.0.0/24 is 192.168.0.255, or just broadcast to 255.255.255.255.

answered 2010-02-27T13:16:44.143
1

You can use the special address of 255.255.255.255 to send a broadcast message to every computer on the local network.

For more info see section IP Network Broadcasting.

answered 2010-02-27T13:15:26.667

Your Answer