|
From: | Joel Pålsson |
Subject: | [lwip-users] lwip_send() fails if sending to much data. |
Date: | Mon, 27 Feb 2012 15:41:28 +0000 |
Hi, I’m trying to use the LWIP socket interface. I found one issue with lwip_send(). Normally socket send() calls returns the number of sent bytes which can be less than the number requested to be sent. In non-blocking mode it seems as lwip_send() returns an error if requested to send more data than it can handle instead of sending the number of bytes it can. My proposal is that the following code: if ((flags & MSG_DONTWAIT) || netconn_is_nonblocking(sock->conn)) { if ((size > TCP_SND_BUF) || ((size / TCP_MSS) > TCP_SND_QUEUELEN)) { /* too much data to ever send nonblocking! */ sock_set_errno(sock, EMSGSIZE); return -1; } } should be changed to: if ((flags & MSG_DONTWAIT) || netconn_is_nonblocking(sock->conn)) { if (size > TCP_SND_BUF) { size = TCP_SND_BUF; } if ((size / TCP_MSS) > TCP_SND_QUEUELEN) { size = TCP_MSS * TCP_SND_QUEUELEN; } } What is your opinion about this? Best Regards Joel Pålsson |
[Prev in Thread] | Current Thread | [Next in Thread] |