How to run AP + TCP-server?
How to run AP + TCP-server?
Postby walt22 » Fri May 19, 2017 5:37 pm
Hello,
I am developing an outdoor remote control system, with a dedicated WLAN from an ESP8266 AP. A tablet with a TCP-client should connect to it in order to set some GPIOs on the ESP. According to my understanding, a TCP-server on the ESP should take the commands from the tablet client for further processing. There is no additional router involved.
Right now, the AP works fine and the tablet can log into the WLAN and gets a proper IP address. But a connection of the client to the server will be refused. So my questions are:
Which mode the ESP should have SOFTAP or STATIONAP?
Is a TCP-server necessary or are other solutions possible?
Which IP address the TCP-server should have, I tried with the address of the AP and a different one, but no success?
I work with None-OS SDK 2.0.
Many thanks for any help
Walter
I am developing an outdoor remote control system, with a dedicated WLAN from an ESP8266 AP. A tablet with a TCP-client should connect to it in order to set some GPIOs on the ESP. According to my understanding, a TCP-server on the ESP should take the commands from the tablet client for further processing. There is no additional router involved.
Right now, the AP works fine and the tablet can log into the WLAN and gets a proper IP address. But a connection of the client to the server will be refused. So my questions are:
Which mode the ESP should have SOFTAP or STATIONAP?
Is a TCP-server necessary or are other solutions possible?
Which IP address the TCP-server should have, I tried with the address of the AP and a different one, but no success?
I work with None-OS SDK 2.0.
Many thanks for any help
Walter
Re: How to run AP + TCP-server?
Postby pratik » Fri May 19, 2017 5:42 pm
By default, the server IP of ESP8266 in AP mode is 192.168.4.1
When you start your server in the ESP, make sure the port is 80.
Seems like you are doing everything right. You can ping the ESP server IP to make sure your ESP setup is good.
Staion + AP mode is not required in your project.
When you start your server in the ESP, make sure the port is 80.
Seems like you are doing everything right. You can ping the ESP server IP to make sure your ESP setup is good.
Staion + AP mode is not required in your project.
Re: How to run AP + TCP-server?
Postby walt22 » Sat May 20, 2017 3:01 am
Hello Pratik,
Many thanks for your quick reply.
I have started the AP and am able to ping his IP address successfully.
But I don´t understand your recommendation regarding port 80, because my client is able to address any port.
What should happen after the AP has started, should I start a TCP-server with the local address of the AP?
A code snippet of this would be very helpful.
Best regards
Walter
Many thanks for your quick reply.
I have started the AP and am able to ping his IP address successfully.
But I don´t understand your recommendation regarding port 80, because my client is able to address any port.
What should happen after the AP has started, should I start a TCP-server with the local address of the AP?
A code snippet of this would be very helpful.
Best regards
Walter
Re: How to run AP + TCP-server?
Postby pratik » Sun May 21, 2017 12:15 am
Ohh, I suggested port 80 because that is the default port in all browsers.
Refer to sample code section here, it works with all SDK versions (nonOS SDK):
http://www.espressif.com/en/products/ha ... /resources
Refer to sample code section here, it works with all SDK versions (nonOS SDK):
http://www.espressif.com/en/products/ha ... /resources
Re: How to run AP + TCP-server?
Postby walt22 » Sun May 21, 2017 6:53 pm
Hello Pratik,
Many thanks for your helpful support!
My test program is now running. What I did:
Start an AP with a given IP address, eg. 10.10.10.1
Start of a TCP-server with a given port, eg. 3333, which fetched the a.m. IP address.
My TCP-client gets from AP the address 10.10.10.2 and is able to commicate with the AP (10.10.10.1).
Now I can continue the development of my remote control.
Best regards
Walter
Many thanks for your helpful support!
My test program is now running. What I did:
Start an AP with a given IP address, eg. 10.10.10.1
Start of a TCP-server with a given port, eg. 3333, which fetched the a.m. IP address.
My TCP-client gets from AP the address 10.10.10.2 and is able to commicate with the AP (10.10.10.1).
Now I can continue the development of my remote control.
Best regards
Walter
Who is online
Users browsing this forum: No registered users and 258 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.