lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] HTTP server: sockets versus netconns


From: Peter Woo
Subject: [lwip-users] HTTP server: sockets versus netconns
Date: Thu, 29 Sep 2011 19:59:49 -0700

I'm using lwip to write an http server. Initially I was using the netconn API, but I'm trying to switch to the sockets API since I find it a bit less awkward.
 
After this change, web clients now receive "connection reset" errors upon visiting a page. I've gotten it to work if the entire response is written in one lwip_send() call, but if for instance the header is written in a different call than the message body then the "connection reset" error occurs (I've checked this with a few browsers). I've checked using telnet to verify that identical data (at the payload level) is being received in either case. In other words
 
>   sprintf(outbuf, "<response header><response body>");
>   lwip_send(sock, outbuf, strlen(outbuf), 0);
>   lwip_close(sock);
 
works as expected but
 
>   sprintf(outbuf, "<response header>");
>   lwip_send(sock, outbuf, strlen(outbuf), 0);
>   sprintf(outbuf, "<response body>");
>   lwip_send(sock, outbuf, strlen(outbuf), 0);
>   lwip_close(sock);
 
does not. It still triggers the error if the MSG_MORE flag is passed to the first lwip_send(), which I thought might help. Neither does a "Connection: close" field in the response header make any difference.
 
 
What could be the issue here?

reply via email to

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