lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] A new users request for help with sending TCP Packets o


From: Noam Weissman
Subject: Re: [lwip-users] A new users request for help with sending TCP Packets on Demand
Date: Tue, 27 Jun 2017 21:55:28 +0000

Hi,


First of all great that you have been able to leap to 2.xx 😊


Keeping the connection open or not depends on your own needs. So there is no

simple reply to that.


As for buffering, it depends on your system design. Do you have an OS or are you

running without an OS, do you have sufficient RAM to create the buffering etc...


Do remember that while using RAW API, sending data not from the TCP own context

is not thread safe, that is if you use threads.


If you use an OS, one way is to use the poll call back and send all the data in the buffer

from within the poll call back. Meaning you add data to the buffer from one task and let

the poll call back check if that buffer has data to. This is a bit slow but easy to keep an eye...


To properly handle the data send you need to keep an eye on send window size etc..


I suggest checking the examples in the contribution section and especially the HTTP

server were you can see how you can send data and keep an eye on how much you

can send.


Another option that will be faster, is to create a call back function and call it from within the

tcp context by calling the sys_timeout function.


This way you set the timeout from your own code and when it is triggered it calls your function.

Your function will access the buffer or what other mechanism you use. You can also use the sent

call back to send more data when the last chunk was already sent, that is if the buffer has more data

to be sent.  


I suggest first to think what you want to achieve and then design how.


Hope the above gave some ideas and helped.


BR,

Noam.



From: lwip-users <lwip-users-bounces+address@hidden> on behalf of mitchj <address@hidden>
Sent: Tuesday, June 27, 2017 9:06 PM
To: address@hidden
Subject: Re: [lwip-users] A new users request for help with sending TCP Packets on Demand
 
Thank you,

I have read that page, and actually lept ahead to 2.0.0, it was an easier
upgrade than I expected. Further, I was able to get a basic example working
sending a string through a client. For now I have only a couple of questions
to help me in my design. I need to expand this so that I can send data from
anywhere in my full application.

So first off:
Is it best to attempt to keep the connection awake, or should this
connection be closed and opened for each transaction? Further, with a client
is there an equivalent of an accept callback that could open the connection
when the server decides to push data to the client? ... I'm probably
revealing how new I am at this.

Second:
How might some of you recommend queuing data to be sent from outside of the
lwip client. As in, my application wants to send data to the server, how
should it get that data into the client? I was thinking I'd write a function
that took raw data and added it to a buffer chain or something like that.

Am I on the wrong path?

Regards,



--
View this message in context: http://lwip.100.n7.nabble.com/A-new-users-request-for-help-with-sending-TCP-Packets-on-Demand-tp29868p29984.html

Sent from the lwip-users mailing list archive at Nabble.com.

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]