1

I want to setup a register / discover type of service connection between 2 devices on the same wireless LAN. Idea is to find, connect and send wireless router password to a new device for easy installation. This needs communication between 2 devices on the same wireless network before connecting to router with SSID, password.

I'm aware of zeroconf, bonjour and mDNS libraries. All implementations I see start with connecting to wifi in station mode to get a local IP with hardcoded SSID and password, which is not known at this stage.

In other words, how can connect to wireless and get a link local IP without SSID and password?

-- Edit for better explanation --

The flow i'm looking for is like this:

1- Mobile phone (iphone or android) is connected to secure home wireless network as usual
2- A new device with wireless interface is powered on first time.
3- Device gets (or sets) a local IP and local dns name (multicast ip and name) for itself
4- Device broadcasts its available services to the network
5- Phone discovers the service, along with devices' local name and even local ip already assigned.
6- Phone initiates a direct connection with the device to send wireless configuration information (ssid and password for the access point)
7 - Device saves this information, resets into normal operation mode
8 - Device connects to internet
9 - Device services are still available in the local network

-- edit --

Code will run on esp32 or esp8266, so compatible c or arduino libraries are ok.

I'm aware of smartconfig implementation of ESPTouch application, but it is a horrible design! Discovery program tries to create sockets to every possible IP address to find the peer IP.

Adnan Senyurt
  • 177
  • 1
  • 2
  • 6

1 Answers1

0

Read this sentence in your question again and think about it:

In other words, how can connect to wireless and get a link local IP without SSID and password?

The protocols you mentioned are only possible AFTER you're part of the network. As you know, wifi networks are protected to prevent unauthorized access.

Try wifi protected setup (WPS) in Google.

BMelis
  • 384
  • 3
  • 16
  • 2
    Not true. I know you can send and receive UDP packets, do p2p socket communication etc. even before connecting through a wireless router with ssid and password. This is how ESPTouch works to transfer the ssid, pwd information to another device in the network. – Adnan Senyurt Jun 15 '17 at 06:05
  • After an extensive reserch, I've found out that you're almost completely right! There is no formal protocol that allows a device to communicate before authenticating with the network. What ESPTouch and SmartConfig is doing is actually sniffing the network and publishing message expressed in terms of package sizes! Here is an excellent article on this: – Adnan Senyurt Jun 19 '17 at 07:27
  • [link](http://depletionregion.blogspot.com.tr/2013/10/cc3000-smart-config-transmitting-ssid.html) This is not a best practice and I give up! Best way to send wireless configuration seems to be via bluetooth or usb. – Adnan Senyurt Jun 19 '17 at 07:35