lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] tcp_write() keeps returning ERR_MEM indefinitely once t


From: Kieran Mansley
Subject: Re: [lwip-users] tcp_write() keeps returning ERR_MEM indefinitely once the buffer is filled
Date: Mon, 13 Dec 2010 13:46:32 +0000

On Mon, 2010-12-13 at 02:57 -0800, Diecol wrote:
> Can u do a example code?

I'd have a look in the contrib module for examples using the raw API.

The code that you posted that sits in a tight loop if it gets ERR_MEM
trying smaller and smaller writes is not a good approach.   If you get
ERR_MEM you have two choices:
1) Try again but send less data: you can use tcp_snd_buf() to find out
how much space there is.
2) Wait until later when there is more space: you can use tcp_sent() to
ask for a callback when there is more space.

Both of these are described in the rawapi document.

You also mentioned in an earlier email getting ERR_CONN sometimes.  I
would look into that as it seems a bit odd.

Good luck!

Kieran




reply via email to

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