Hello, I'm trying to implement a TCP/IP Stack with a running web server. I took code from the http_demo project. The systems runs, I can connect and display the website on my browers. After a few refreshes, it stops working. Obviosly, there is no more free socket available. On on page of the website, I can see the available sockets, and everytime I refresh, another socket connects and goes into TWAIT state, but neither times out, nor disconnects, therefore I run out of sockets. I have set the Timeout Wait period to 5 seconds, but does not make a difference. Thanks for any help.
On which target hardware are you running?
Hello, I'm running on an LPC2148, and I'm using an Microchip ENC28J60 SPI based Ethernet controller. Everything works fine and stable. I get ping replies, and I can display the website. I'm not sure wether the sockets are to be closed by the client browser, or due to a timeout. On the status website I can see an overview of the sockets. It shows one connected socket, which is the transmission of the current website. It says CONNECTED and a timeout value of 120. The sockets that were used for earlier connections display TWAIT, but a timeout value of 0. Again, thanks a lot for your help.
HTTP server does use multiple sockets, however they are properly closed after the transmission. On the Status page, you should see only one socket in CONNECTED state and a timeout value of 120. All other sockets should be closed. If this is not the case, then your ethernet driver does not work correctly.
It seems to me that some packets are lost or not correctly received. That is why you see some of TCP sockets in TWAIT state - waiting for a timeout. Because those sockets are not free, a new socket is allocated on every mouse click from your browser.
Franc