How to send data over a TCP connection ...

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

How to send data over a TCP connection ...

Postby kolban » Thu Jul 09, 2015 12:45 pm

I have been studying the TCP connection technology and think I understand but I have some questions.

I believe that what I need to do is form a connection and then execute an espconn_sent() API call. This takes a buffer and a length and, I presume, sends the data. I notice that the length is an unsigned 16 bit value ... so that tells me that I can only send 16KBytes in one operation. Is that correct?

I am assuming that, like all the other SDK APIs, this command does not block. So that seems to say that I can call espconn_sent() and then immediately call a second espconn_sent() ... however ... my belief is that would be wrong. Instead, one should send data via espconn_sent() and return control back to the OS. When a sent_callback occurs, that is an indication that the data previously asked to be sent has now ACTUALLY be sent and we can repeat and send new data.

Is this assumption correct?

tve
Posts: 123
Joined: Sun Feb 15, 2015 4:33 pm

Re: How to send data over a TCP connection ...

Postby tve » Thu Jul 09, 2015 12:50 pm

sorry to say, but you're pretty far off. after espconn_sent you need to wait for a callback that tells you that the buffer got sent. There are two flavors of callbacks depending on whether you asked the SDK to buffer or not. And you can't send that much at a time, I believe the send buffer is 2600 bytes or thereabouts, unless you use the 536 byte MSS version of liblwip... I recommend you read some open source code out there ;-). https://github.com/jeelabs/esp-link/blo ... pd/httpd.c might be one place to start, Espressif also has some demos...

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

Re: How to send data over a TCP connection ...

Postby kolban » Thu Jul 09, 2015 10:26 pm

Howdy Tve,
I really do appreciate your feedback. Its hard to find skilled folks in ESP8266 that I can chat with. Can I ask a favor though ... can you read my post again ... I'm missing what my error in understanding is ... as far as I can tell, your response is very, very similar to what I was thinking was happening ... and of course, I may be missing the wood from the trees ... if you can point out where my understanding is wrong, that would be awesome.

If you need an ESP8266 buddy to shoot the breeze with, let me know .. I'll be happy to exchange emails and skypes to chat.

Neil

tve
Posts: 123
Joined: Sun Feb 15, 2015 4:33 pm

Re: How to send data over a TCP connection ...

Postby tve » Sat Jul 11, 2015 3:00 pm

I think you're right. I had some trouble following all the twists and turns of your post ;-)

Who is online

Users browsing this forum: No registered users and 30 guests