Receive TCP and UDP simultaneously
Posted: Mon Jan 18, 2021 5:48 pm
I'm experimenting with an ESP8266, connected to an ATMEGA88, and configuring it via AT commands. I've got it set up to connect to my wifi with a TCP connection, and it receives data OK. Now I want it to also listen for UDP broadcasts. But I can't get it to work.
The setup for TCP is something like this:
where "x.x.x.x" is the IP of my server (i.e., Android app, on same network) at port 10000.
So, it sets application mode to "both station and access point" (3); connection mode to "single" (1); application mode to "normal" (0); and then establishes the TCP connection (on IP x.x.x.x:10000). As I said, this works But when I try to follow this guide (https://www.espressif.com/sites/default ... n_v1.3.pdf) to set up UDP "as well", I end up getting error "CIPMUX and CIPSERVER must be 0"
Basically, what I'm trying to modify (with TCP + UDP) is to set connection mode to "multiple" (i.e. AT+CIPMUX:1) and then essentially do,
As I understand it, this second line will begin listening for UDP broadcasts on port 4445 -- from any IP address.
Does anyone see what's gone wrong here? CIPMUX must be set to 1 (multiple), right, to use TCP *and* UDP simultaneously?
The setup for TCP is something like this:
Code: Select all
description command expected response
====================================================================================================
Begin ATE0 / AT OK
WIFIMode AT+CWMODE=3 OK
ConnectionMode AT+CIPMUX=0 OK
ApplicationMode AT+CIPMODE=0 OK
connected ? AT+CIPSTATUS STATUS:2 (ESP8266_CONNECTED_TO_AP)
Start AT+CIPMUX? CIPMUX:0
AT+CIPSTART="TCP","x.x.x.x",10000 CONNECT
STATUS:3 (ESP8266_CREATED_TRANSMISSION)
where "x.x.x.x" is the IP of my server (i.e., Android app, on same network) at port 10000.
So, it sets application mode to "both station and access point" (3); connection mode to "single" (1); application mode to "normal" (0); and then establishes the TCP connection (on IP x.x.x.x:10000). As I said, this works But when I try to follow this guide (https://www.espressif.com/sites/default ... n_v1.3.pdf) to set up UDP "as well", I end up getting error "CIPMUX and CIPSERVER must be 0"
Basically, what I'm trying to modify (with TCP + UDP) is to set connection mode to "multiple" (i.e. AT+CIPMUX:1) and then essentially do,
Code: Select all
AT+CIPSTART="TCP","x.x.x.x",10000
AT+CIPSTART=0,"UDP","0.0.0.0",4445
As I understand it, this second line will begin listening for UDP broadcasts on port 4445 -- from any IP address.
Does anyone see what's gone wrong here? CIPMUX must be set to 1 (multiple), right, to use TCP *and* UDP simultaneously?