ESP8266: How to set the local port in UDP?

Gaston06
Posts: 1
Joined: Thu Mar 22, 2018 1:26 am

ESP8266: How to set the local port in UDP?

Postby Gaston06 » Thu Mar 22, 2018 1:43 am

Hello,
I am trying to make an Access Point + UDP server using AT commands.
In short, it works, but I cannot control the ESP8266 local port, because it is set at random by the chip.
I want to make a server with a known, fixed port, so that remote clients can initiate the connection (i.e. access it without having to know that random port).
The commands I use are:
AT+CWMODE=2 (or 3)
AT+CIPMUX=0
AT+CIPSTART="UDP","192.168.4.2",50000
-> at that point, I have to use AT+CIPSTATUS to get the ESP8266 port number.
then AT+CIPSEND etc work
Any idea? Thanks!

Her Majesty
Posts: 345
Joined: Mon Oct 27, 2014 11:09 am

Re: ESP8266: How to set the local port in UDP?

Postby Her Majesty » Tue Mar 27, 2018 6:50 pm

I think it is the AT+CIPSTART="UDP","192.168.4.2",50000,<local port> you can add the local port at last, it is defined in the doc. https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf

Who is online

Users browsing this forum: No registered users and 6 guests