On 11Jun2019 10:35, John Hoeksema <jhoek...@nd.edu> wrote:
Summer researcher using Raspbian and Python 3.5.

I'm trying to use a Raspberry Pi 3 B+ to broadcast a message using the
sockets library to other Pis (same model) over their shared ad-hoc network.
All of the Pis can ping the others over the ad hoc network. The Pis can
also communicate using pretty standard client-server code and the python
socket library <https://docs.python.org/3.4/library/socket.html>. However,
when I try to *broadcast* a message, the Pis give a "Network is
unreachable" message (full error down below). A grad student I'm working
with said that the script he provided me expects the server to be run in
infrastructure mode, and configuration for ad-hoc mode is required to make
it work correctly. This is confirmed, as I have successfully run the code
on a desktop. I have poured over man pages and stackoverflow, and can't
seem to find resources for how to configure socket broadcasts for ad-hoc
networks. Any thoughts?

I would start by debugging a bit outside of Python first. And I've never used an ad hoc wifi network, but after setup I _imagine_ that it looks like a normal local network: an IP address and a network mask, so "braodcast" is the usual notion of the IP address with all 1s in the local part.

So 1:

Does a manual command line "ping" of the broadcast address work? Eg, if the local network were 192.168.3.x/24 and I went:

 ping 192.168.3.255

(or on Linux):

 ping -b 192.168.3.255

I'm assuming your '<broadcast>' below is an actualy broadcast address? Or is it a special string? If so, what happens if you hand construct a broadcast IP like the *.255 above? Any different?

Does tcpdump show anything useful, either locally or on one of the other Pis? Though given "Network is unreachable" I'd guess no packets get sent at all.

I repeat my disclaimer: I've not used an ad hoc wifi network.

Cheers,
Cameron Simpson <c...@cskk.id.au>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to