-->
Page 1 of 2

Issue with my TCP server

PostPosted: Mon Jun 08, 2015 6:45 pm
by dkinzer
I'm experimenting with a TCP server which is almost working. Using telnet, my server accepts a connection on port 80. However, when I send text to the server (by typing a line in telnet) the callback set up with espconn_regist_recvcb() isn't invoked. I also have callbacks for disconnect, reconnect, data sent and write finish but none of them get invoked either.

The registration of the connect callback is done just before the call to espconn_accept() and the remaining callbacks are registered in the connect callback. Is this the correct sequence? Is there anything else I'm missing.

As an aside, I have both TCP and UDP clients working without any problems so I know that I'm doing at least some things correctly.

Don Kinzer

Re: Issue with my TCP server

PostPosted: Mon Jun 08, 2015 7:22 pm
by dkinzer
I forgot to mention that i was initially developing this code using the v1.0.1 b2 SDK and changed to the v1.1.0 SDK hoping that the problem would resolve itself. Alas, it did not.

Don Kinzer

Re: Issue with my TCP server

PostPosted: Tue Jun 09, 2015 1:07 pm
by dkinzer
I finally figured out what the problem was - it's obvious now but it certainly wasn't before. The issue was that the struct espconn pointer that is passed to the connect callback is different than the one that was passed to espconn_accept(). Clearly, this is necessary if multiple simultaneous connections are supported.

After I changed my code to use the pointer passed to the callback to set up the send, receive and disconnect callbacks everything started working as expected.

Re: Issue with my TCP server

PostPosted: Thu Jun 18, 2015 9:35 am
by Bontor Humala
Hi Don, I am looking to experiment on the same topic. Would you be so kind to share your code? Thanks man