hamilc
Posts: 143
Joined: Fri May 16, 2014 9:59 pm

Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 3:19 am

Can I program two pi so listen to a specific (but different) 168.100.???.??? adresss and have them communicate directly without having to go through a router or to install hotspot software? It seems like this should be possible. Can it be easily done? Is it just a matter of setting up a special listening address and port?

OO-Dragon
Posts: 7
Joined: Sat Jun 02, 2018 3:09 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 3:22 am

No because by default, they are both "Clients". They still need a "Server" to connect to. So one has to be a HotSpot or AD Hoc setup.

mattmiller
Posts: 1888
Joined: Thu Feb 05, 2015 11:25 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 6:29 am

Can it be easily done? Is it just a matter of setting up a special listening address and port?
No and No

btidey
Posts: 1571
Joined: Sun Feb 17, 2013 6:51 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 8:02 am

You need one of the Pi's to be an access point (AP). This is like half of a hotspot.

See first part of https://www.raspberrypi.org/documentati ... s-point.md for a comprehensive tutorial.

Note that you could skip the dhcp part if you set up static ip addresses.

User avatar
davidcoton
Posts: 3057
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 8:48 am

hamilc wrote:
Mon Jul 16, 2018 3:19 am
Can I program two pi so listen to a specific (but different) 168.100.???.??? adresss
Note that the address range should be 192.168.???.???
168.100.???.??? will be allocated to someone else
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

hamilc
Posts: 143
Joined: Fri May 16, 2014 9:59 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 12:33 pm

Thanks for the unfortunate info but as an old retired engineer, I want to know why UI need an access point.

First, if you set up a "hot spot", then the Pi is obviously listening for another Pi so there is no reason for the Pi to not be able to receive a signal from another Pi. If both Pis have a static address and port assigned, then it seems to me that each one should be able to be set to listen mode. Obviously, when the router sends a message to the Pi, it has to be in listen mode, yes? Once the message is received, then why can't the Pi merely be set to transmit and send a reply? It seems to me that someone set up the hotspot software and now everyone thinks that is the only way the Pi can be used. It doesn't make sense to me.

The link that someone referred me to mentioned the DHCP complication. For a Pi to communicate directly to another Pi, static addresses should be fine. No DHCP should be required.
There must be a way.

hippy
Posts: 3337
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 12:55 pm

hamilc wrote:
Mon Jul 16, 2018 12:33 pm
Thanks for the unfortunate info but as an old retired engineer, I want to know why UI need an access point.
Setting up the communication medium and what that handles are two separate things.

WiFi requires one thing to be a master and the rest to be slaves. That master will normally be a router or an access point and in a two Pi set-up one has to be the access point, so the other can connect to it.

If both were listening, nothing would be sent from either to the other. If both were sending, nothing would be listening. One has to be listening and the other sending.

How data is passed is then independent of all that once the connection is established.

hamilc
Posts: 143
Joined: Fri May 16, 2014 9:59 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 1:03 pm

I still don't understand. lets forget that we are using the Wi-Fi "layer" and think of only using TCP/IP by itself. I am sure that using the basic TCP/IP routines one can communicate between Is without a router. I think when I mentioned WiFi that the conversation meant that we HAD to use Wi-Fi routines. Lets forget Wi-Fi and think about using the TCP/IP routines. There must be some software to do this.

Think about the old serial RS-232 days. There was no master or slave here. Both were always receiving/listening and then when one wanted to transmit then they did so.

ghans
Posts: 7769
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 1:11 pm

This is called Ad-Hoc mode. The WiFi standard explicitly deliberates on this. Most people don't bother because it is always a hassle in practice. See:

https://github.com/simondlevy/RPiAdHocWiFi

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

hamilc
Posts: 143
Joined: Fri May 16, 2014 9:59 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 1:16 pm

I think I wanting to do "socket" programming.

ghans
Posts: 7769
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 1:25 pm

You cannot communicate on Layer 4 ("sockets") if the layers below are not working.
Ad-Hoc Wifi would solve communication on layers 1 and 2 AFAIK.

Please tell me how YOU want to physically connect two Raspberry Pis on Layer 1. I can think of four possible ways (one of them being WiFi in AdHoc mode) ...

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

RootKiiit
Posts: 8
Joined: Wed Nov 20, 2013 6:52 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 1:46 pm

hamilc wrote:
Mon Jul 16, 2018 3:19 am
Can I program two pi so listen to a specific (but different) 168.100.???.??? adresss and have them communicate directly without having to go through a router or to install hotspot software? It seems like this should be possible. Can it be easily done? Is it just a matter of setting up a special listening address and port?
hamilc, gooogles about batman-adv and IPv6 :)


hippy
Posts: 3337
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Can I using wi-fi connect two pi's together without a hotspot?

Mon Jul 16, 2018 3:20 pm

hamilc wrote:
Mon Jul 16, 2018 1:03 pm
lets forget that we are using the Wi-Fi "layer" and think of only using TCP/IP by itself. I am sure that using the basic TCP/IP routines one can communicate between Is without a router.
Correct. For a wired network; just connect one device's RJ45 to the other device's RJ45. They can both communicate between themselves, either or both can be listening for connections and data from the other.

It usually helps to have IP addresses assigned to both in the same subnet but even when not that can be worked around.

But if using WiFi, or connecting other than using a direct one-to-one wired connection, then you will have more constraints to work within.

OO-Dragon
Posts: 7
Joined: Sat Jun 02, 2018 3:09 pm

Re: Can I using wi-fi connect two pi's together without a hotspot?

Sat Jul 21, 2018 3:16 am

hamilc wrote:
Mon Jul 16, 2018 1:03 pm
I still don't understand. lets forget that we are using the Wi-Fi "layer" and think of only using TCP/IP by itself. I am sure that using the basic TCP/IP routines one can communicate between Is without a router. I think when I mentioned WiFi that the conversation meant that we HAD to use Wi-Fi routines. Lets forget Wi-Fi and think about using the TCP/IP routines. There must be some software to do this.

Think about the old serial RS-232 days. There was no master or slave here. Both were always receiving/listening and then when one wanted to transmit then they did so.
You can think of it this way. With Ethernet, you physically connect a cord, before any TCP/IP can work between the units. Creating a wireless Access Point with one Pi and connecting the other to it, is the equivalent of connecting that physical cable.

More Detail: With wireless, its sending all over the place, it doesn't go from one unit to another like Ethernet (contained inside the cord). The pi's Wireless sends data omni directional and it has to be able to tell the difference between signals meant for it, and ones that are not (not to mention getting send receive timings right, so you don't miss packets). So in order to isolate what's yours, you tell both units who and how they are connecting to each other. That process is setting up a Access Point (can be Ad-Hoc or Infrastructure like a router) and connecting the other unit to it.

Something else you may want to think about, is buying a small cheap router like this, and have both units connect to that. Its a LOT simpler to setup, and can be mobile due to the USB power for the router, and its very small power usage (had one running for 5 days on a big USB battery bank). O it also greatly increases the range you can have between the units.

https://www.amazon.ca/GL-iNet-GL-MT300N ... words=inet

Return to “Beginners”

Who is online

Users browsing this forum: Bing [Bot], W. H. Heydt and 37 guests