[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Transfer Mibs of data over TCP
From: |
Sylvain Rochet |
Subject: |
Re: [lwip-users] Transfer Mibs of data over TCP |
Date: |
Mon, 3 Apr 2017 23:30:52 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi,
On Mon, Apr 03, 2017 at 01:43:44PM +0000, Noam Weissman wrote:
> Hi,
>
> Why not use the RAW API server that is in the contribution ?
>
> I am not using it because am using my own modified code that was created
> before the current version.
> As far as I know it works nicely and many are using it ☺
>
> I have no problems accepting a large file 1MB… never had to accept a larger
> file but I do not think it makes
> any difference.
>
> I think that if netbuf_next() fails you need to add some delay and try again.
> I mean add vTaskDelay(10) or similar and try again.
>
> When you transfer large amount of data you may get into cases that the
> network has some lag.
> In that case your netbuf_next() call nay fail.
>
> Doing something like this:
>
> #define READ_ERROR_DELAY 10
> #define READ_ERROR_TIMEOUT 500
>
> err_t MyRead( params )
> {
> Int RetVal , TotalTimeOut = 0;
>
> Do
> {
> RetVal = netbuf_next();
>
> If(RetVal == (-1))
> {
> vTaskDelay(READ_ERROR_DELAY / portTICK_RATE_MS);
> TotalTimeOut += READ_ERROR_DELAY;
> }
> else
> {
> break;
> }
>
> } while(TotalTimeOut < READ_ERROR_TIMEOUT);
>
> }
>
>
> The above function will try to read from the socket and if fails it will
> delay for about 10 ms… that way you give
> the TCP and other system tasks time to run.
>
> If the above is not an option due to system constrains you can adapt some
> kind of state machine, per connection
> and use lwip own function sys_timeout to trigger for the above function or
> similar.
>
> Hope that gives some ideas…
WTF. Did you even read what the netbuf_next() function actually does ?
Sylvain
signature.asc
Description: Digital signature