Main Site Documentation

Webserver Stops


#1

I tried the example:
http://wiki.tinyclr.com/index.php?title=Webserver
With the option of automatically browser update.

My problem is now that the code stops in the infinite loop with the

Socket newSock = listenSocket.Accept();

after 31 browser updates.

It seems that something is not released and hits a maximum.


#2

See this, it may help http://www.tinyclr.com/forum/10/1901/


#3

Yes, it does.

The example eats up sockets…

Socket newSock = listenSocket.Accept();
-> newSock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true);
string s = “Hallo World”;
byte[] messageBytes = Encoding.UTF8.GetBytes(s);
newSock.Send(messageBytes);
newSock.Close();

Will cause the socket to close and one can hit update “F5” in the browser forever - but the auto update browser will fail.

I have got the point and will make some code that keep the connect to the browser as long as it is connected. Socket newSock = listenSocket.Accept(); should be use one time only in a connection - and not as an update request detector.