lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip-users Digest, Vol 164, Issue 4


From: Tóth Norbert
Subject: Re: [lwip-users] lwip-users Digest, Vol 164, Issue 4
Date: Tue, 4 Apr 2017 07:58:19 +0200

Hi Noam,

I sounds interesting,
I may confused regarding the netconn API functions:
  • what does the netconn_recv() function if I call it two or more times on the same netconn object?
  • is the netbuf_next() method exactly, who read further data from the connection?
I will check your solution and notify about the result.

Regards,
Norbert


2017-04-03 23:16 GMT+02:00 <address@hidden>:
Send lwip-users mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of lwip-users digest..."


Today's Topics:

   1. Re: Transfer Mibs of data over TCP (Noam Weissman)


----------------------------------------------------------------------

Message: 1
Date: Mon, 3 Apr 2017 13:43:44 +0000
From: Noam Weissman <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Subject: Re: [lwip-users] Transfer Mibs of data over TCP
Message-ID:
        <AM5PR0902MB2066F1E997ED4BC95Caddress@hiddeneurprd09.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

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?

Good luck,
Noam.

From: lwip-users [mailto:lwip-users-bounces+noam=address@hidden] On Behalf Of T?th Norbert
Sent: Monday, April 03, 2017 4:03 PM
To: address@hidden
Subject: [lwip-users] Transfer Mibs of data over TCP

Hi Folks,

I develop a system based on the followings:

  *       TM4C1294 TI Cortex M4 CPU
  *       FreeRTOS 7.x
  *       TinyFS for FAT file system handling on SD card
  *       LwIP 1.4.1 netconn API
I have to receive files (20-40MB) via HTTP POST request and store them into SD card (basically it is a simple HTTP file server).
Due to the other design decisions and the FreeRTOS, using "netconn" API seems to be the most suitable for me.
My problem is that it only works well with small files (20~100B) not with the desired sizes. I implemented the following logic looks like:

  *   wait for an incoming connection
  *   parse the HTTP header (excluding resource name and method)
  *   write the rest of data from the current pbuf
  *   repeat the following while data can be read from the connection:

     *   acquire the next "part" of data by netbuf_next()
     *   if it results -1

        *   delete the current netbuf by netbuf_delete()
        *   call netconn_recv() on the connection

     *   store data (if all the above result success)

Can anybody help me, what should I fix?  What did I wrong?

Regards,
Nobert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/lwip-users/attachments/20170403/86a62e24/attachment.html>

------------------------------

Subject: Digest Footer

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

------------------------------

End of lwip-users Digest, Vol 164, Issue 4
******************************************


reply via email to

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