Using two servers (HTTP and TELNET ports)

uTasker
Posts: 19
Joined: Mon Mar 15, 2021 10:15 pm

Using two servers (HTTP and TELNET ports)

Postby uTasker » Thu Jan 05, 2023 12:07 am

Hi All

I need to have two TCP servers running. One on the HTTP port 80 and one on the Telnet port 23.

These commands are sent to create the servers:

at+cipmux=1
at+cipservermaxconn=5
at+cipserver=1,80
at+cipserver=1,23

All are acknowledged with OK.

I can now connect on TCP port 80 but connection attempts on TCP port 23 are answered with TCP RSTs (as if the server address is not being recognised).

If I then do
at+cipserver=0
to destroy the server(s), followed by
at+cipserver=1,23
the telnet port can connect.

If I start again and do
at+cipmux=1
at+cipservermaxconn=5
at+cipserver=1,23
at+cipserver=1,80

The telnet connection (23) works but not the HTTP one (80).

The behavior is as if the second server port setting is OKed but in fact ignored.
It is also as if only one server ever exists on only one port.

I can however connect multiple Telnet (23) connections, as shown by the status when 2 are connected:

+CIPSTATUS:0,"TCP","192.168.1.120",50801,23,1
+CIPSTATUS:1,"TCP","192.168.1.120",50835,23,1


Question:
- it is true that the ESP32-AT only supports a single listening TCP port?
- or is a different method needed to achieve more than one TCP port?

Finally, I will also require a UDP listener too.

Will this be possible?

Regards

Mark

ESP_Sun
Posts: 320
Joined: Thu Dec 30, 2021 9:52 am

Re: Using two servers (HTTP and TELNET ports)

Postby ESP_Sun » Thu Jan 05, 2023 9:00 am

uTasker wrote:
Thu Jan 05, 2023 12:07 am
Hi All

I need to have two TCP servers running. One on the HTTP port 80 and one on the Telnet port 23.

These commands are sent to create the servers:

at+cipmux=1
at+cipservermaxconn=5
at+cipserver=1,80
at+cipserver=1,23

All are acknowledged with OK.

I can now connect on TCP port 80 but connection attempts on TCP port 23 are answered with TCP RSTs (as if the server address is not being recognised).

If I then do
at+cipserver=0
to destroy the server(s), followed by
at+cipserver=1,23
the telnet port can connect.

If I start again and do
at+cipmux=1
at+cipservermaxconn=5
at+cipserver=1,23
at+cipserver=1,80

The telnet connection (23) works but not the HTTP one (80).

The behavior is as if the second server port setting is OKed but in fact ignored.
It is also as if only one server ever exists on only one port.

I can however connect multiple Telnet (23) connections, as shown by the status when 2 are connected:

+CIPSTATUS:0,"TCP","192.168.1.120",50801,23,1
+CIPSTATUS:1,"TCP","192.168.1.120",50835,23,1


Question:
- it is true that the ESP32-AT only supports a single listening TCP port?
- or is a different method needed to achieve more than one TCP port?

Finally, I will also require a UDP listener too.

Will this be possible?

Regards

Mark
Hi,

At present, the device can only create one TCP server and listen to one port at most, and cannot create two servers at the same time. However, one port of the TCP server and one client can use different ports to create multiple TCP connections (or different clients, of course).

If you need to create two server functions at the same time, you may need to customize the command to implement it. For how to customize the command at AT, please refer to the document: https://docs.espressif.com/projects/esp ... mands.html

OK is returned when the second server is created for the device. This is a known problem. Theoretically, it should return ERROR. This problem is currently being fixed internally.

The device can create TCP server (AT+CIPSERVER) and UDP transmission (AT+CIPSTART) at the same time.

uTasker
Posts: 19
Joined: Mon Mar 15, 2021 10:15 pm

Re: Using two servers (HTTP and TELNET ports)

Postby uTasker » Thu Jan 05, 2023 4:39 pm

Hi

Thank you for the information.

For the UDP case I need to have a TCP server and receive UDP data at the same time (in fact I don't actually need to "transmit" UDP data).
This probably means that it can't be done either with ESP-AT without customising it (?)

At the moment I am also trying to build the ESP-AT version for the ESP32-S2 (details in another recent thread) but this is failing due to bad parameter sin its build process. It may be because it can't be built with the newest IDF - can you confirm this before I de-install everything and start trying again?

Regards

Mark

Who is online

Users browsing this forum: No registered users and 47 guests