Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Broadcast a message to all available machines on WiFi

my apologies if this is a trivial question.

I've recently begun doing some android programming and I'm writing a simple app that allows you to use your android device as a controller for your windows PC. Specifically it allows the user to do things like turn off the machine, make it sleep, reboot it etc etc. I'm currently using a python library called CherryPy as a server on the windows machine to execute the actual win32api calls to perform the desired function. What i'm not sure about is how to discover (dynamically) which machine on the network is actually hosting the server. Everything is working fine if I hardcode my machines public IP into the android app, but obviously that is far less than ideal. I've considered having the user manually enter their machines public IP in the app, but if there's a way to, say, broadcast a quick message to all machines on the WiFi and check for a pre-canned response that my Python server would send out, that'd be wonderful. Is that possible?

Thanks in advance guys.

like image 252
Alex Sullivan Avatar asked Jan 31 '13 20:01

Alex Sullivan


People also ask

How do you send a message to all computers on the same Wi-Fi?

You can use the net send command to send messages to other computers on your network. The command is used through the Command Prompt. You can open the Command Prompt from the Start menu or by pressing ⊞ Win + R and typing "cmd".

What does broadcast message to all mean?

Broadcast texting is the process of sending mass text messages to a bulk list of recipients. Broadcast messages show up as texts from a dedicated phone number or shortcode (a five or six-digit number that works like a phone number) used by campaigns and organizations for text messages.

How do I send messages to Wi-Fi clients on my Wi-Fi network?

example: msg * - This will send the message to everyone on the server. msg username - sends message to the particular user. msg @filename - Useful in group messaging, “filename” is the file which contain all the Usernames/Sessions/Session ID's that you want the message delivered to.

How do you broadcast a message on a network?

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.


2 Answers

Try sending a UDP packet to the special broadcast address 255.255.255.255. Every device in the network should receive a copy of that packet (barring firewalls), and you can arrange to have the server reply to the packet with its identity.

like image 90
nneonneo Avatar answered Oct 01 '22 10:10

nneonneo


Write your app using the alljoyn framework. AllJoyn will handle these details for you.

like image 22
David Avatar answered Oct 01 '22 08:10

David