Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By rDr4g0n
#32509 Hey!

I have 2 eps's that I am trying to get sending messages back and forth. One, lets call it server_a, creates an AP, and also a WiFiServer. The other, lets call it client_b, connects to server_a's AP without a problem, but cannot connect to server_a's WiFiServer.

Here is a gist with server_a.ino and client_b.ino:
https://gist.github.com/rDr4g0n/ce7efed ... rver_a-ino
https://gist.github.com/rDr4g0n/ce7efed ... ient_b-ino

The server comes up fine and is listening for tcp connections, and the client connects to the AP fine, and repeatedly tries to connect to the server with no success.

It should be noted, i can use my laptop to connect to the server's AP and create TCP connections (using netcat) to it with no problems. Also, If I have both esp's connect to my home wifi AP (instead of having server_a setup an AP), the client is able to connect to server_a as expected. This issue I am running into only happens with server_a acts as AP and tcp server, and client_b connects to server_a's AP and attempts to connect to it's tcp server.

One final detail... I dug into WiFiClient.cpp and verified that the connect method fails at the following spot: https://github.com/esp8266/Arduino/blob ... t.cpp#L118

However, my poor C skills prevent me from making much sense of the tcp_new function, so I cannot troubleshoot further.

Any suggestions? Am I doing something hilariously and obviously wrong?

Thanks!
User avatar
By rDr4g0n
#32571
lethe wrote:See viewtopic.php?p=31359#p31359


Perfect. It's hard to come up with the right search terms for this kind of thing.

In case this is helpful to future humans who find this post:

Unless you disable SoftAP (or change its IP) on the client ESP, it will also have an interface with the IP 192.168.4.1, so it will always route packets to 192.168.4.1 to its own interface.
You either need to put the client ESP in client only mode or change its SoftAP IP (if that's possible using AT commands). I would advice you to do the former, since that should also reduce power usage (because the wifi rx does not need to run 100% of the time in client mode).