A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By MVRP
#89358
quackmore wrote:clear your mind and google for "TCP/IP model and layers"

you'll find out that your phone hotspot is just managing the network and the IP layers (as you already noticed)

above those two layers you (I mean your APP and your ESP) have to take care of the transport and the application

examples are TCP for transport and HTTP or MQTT for application

whatever you'll choose, your ESP (or your APP) will have to act as a server and will state the port while the APP (or the ESP) will have to act as a client and will have to know the port to connect to the server


While in UDP mode, the ESP is still a client but it can grab a port number with AT+CIPSTART command but the same does not go in TCP mode.
User avatar
By quackmore
#89373 never used AT commands
so had to get a quick read of https://www.espressif.com/sites/default/files/documentation/4b-esp8266_at_command_examples_en.pdf

not really sure I understood your setup and what you are doing
so this is just my guess, and I may be wrong

you establish a UDP trasmission between the ESP and your APP
then
you can send data from the ESP to the APP
but you can also send data from the APP to the ESP
because using UDP the ESP and the APP are just peers, anyone can start sending data

when you establish a TCP connection between the ESP (client) and your APP (server)
you can send data from the ESP (client) to the APP (server)
but you cannot send data from the APP (server) to the ESP (client) cause the ESP "cannot grab a port"

this is because TCP is a connection-oriented protocol while UDP is connection-less
the server is not expected to send data to the client if not requested by the client itself
and the client is not expecting incoming information that it didn't request

if you want to move data from your APP to your ESP using TCP you have two options:
    you keep your current setup: APP is the server and your ESP is a client, then the ESP asks for information to the APP
    you change the setup: the ESP works as a server and the APP is the client and then the APP can send information to the APP (not sure if you can make the ESP work as a server using AT commands cause I never used them)