lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Normal way how highlevel API interfaces with stack ?!


From: K.J. Mansley
Subject: Re: [lwip-users] Normal way how highlevel API interfaces with stack ?!
Date: 01 Dec 2004 14:16:15 +0000

On Wed, 2004-12-01 at 13:32, Bonny Gijzen wrote:
> Hi,
>  
>  
> I am trying to understand how (highlevel) BSD style API interfaces
> with any IP stack (like lwIP).
> Let me try to explain my issue/question with an example.
>  
> Highlevel API:
>  
> if (SendSomeData(&send_buf, len, send_timeout)==RES_OK)
> {
> if (WaitForData(&receive_buf, 10, rec_timeout)==10)
> {
>   //successfully received my response, do something with it
> } else {//some error like timeout or too few databytes received}
> } else {//some error during sending of data}
>  
> My question is what will happen if one of the 2 highlevel functions
> fail?
> Assume the SendSomeData() fails. This means normally (I think) that an
> ACK is not received yet in lowlevel land. This means this piece of
> data is being retransmitted some number of times.
>  
> Assume my timeout is set to 5 seconds.
> So in highlevel land, after 5 seconds I fall through and do nothing
> (or some error code).
> But in lowlevel land this data is still being retransmitted until the
> MAXRETRY.

This is not specific to lwIP, so this is perhaps not the best place to
discuss it.  If you want a full understanding of the BSD sockets API
there are many good books on this topic - I can suggest some if you're
interested.  However, I can answer your specific question:

Normally the sockets API will return to the application (with no error -
i.e. success) before the data have even been transmitted once.  Usually
the send() function returns when it has successfully put something on a
queue of things to be sent.  It does not wait until the data are
actually transmitted, and certainly doesn't wait until the data have
been acknowledged, before it returns.  If you need to know that data
have been successfully received you need some sort of higher application
layer protocol that will communicate this fact back to you from the
receiver.

Hope that helps,

Kieran





reply via email to

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