hi,
thank for reply.

there are about 150 clients (in average) connected at the same time. sometimes program hang after 15 minutes of running, sometimes after several hours.

I think there is no memory problem because server has a lot of memory and when I check it using taskmanager there is a lot of free memory (service itself is consuming about 58 mb of RAM), procesor time of the process is below 1%. There are about 10 connection in TIME_WAIT state. Values are taken when service is running without problem, I will check it again when it will hang.

I am not sure what does TIME_WAIT means - by googling I have found that it is closing socket waiting for final messages handshaking - is it true? I hope it is not my problem because if client is not active (1 minute) it is disconnected by the server. Is it possible that sockets which were not correctly disconnected (e.g. clients was disconnected from network) will stay in TIME_WAIT state? Even when server close them explicitly after communication timeout?

Service is running on more servers and it seems to work fine with less clients. I have problem only on one server - unfortunatelly there is no chance to debug service (only write to log is possible).

I will try to test in GUI application.

I did some test and now I have 2 version:

version 1: incoming data are received in main thread and are written to buffer of client, client has own thread to process data in buffer version 2: data are received in client thread (in same way as in demo thread application)

It seems version 1 is more stable but it will hang too. Processing of data is done by the same procedures so I hope there is no difference.


Lukas


Dne 18.8.2011 11:26, Wilfried Mestdagh napsal(a):
Hi,

When receive returns -1 then it indicate an error, but you don't have to
worry about it. If MultiThread is True then TWSocket uses his own message
pump. You can use it yourself also or override it.

If OnDataAvailable is called in a closed loop then there is something wrong
with winsock.

You tell that it happens after a while when many clients connecting (and
disconnecting ???). Is this predictable?

Is it possible you have many sockets in TIME_WAIT state or that you have run
out of non-pagable memory? You can check the former with 'netstat -a'. The
latter with task manager. Note that a socket uses 10kb (or more depeniding
on traffic), that non-pagable memory is maximum 1/8 of total real memory
(not virtual).

Have you the same problem if you run the same application in a GUI or
console application?

You can set wsoNoReceivedLoop for each client then OnDataAvailable is not
called in closed loop but with a message handler. Eventually more easy to
debug?



--
lukas skala
envinet a.s.
divize projektu a inzenyringu (project and engineering division)
modrinova 1094
674 01 trebic

tel: +420 568 409 862 (811)
fax: +420 568 409 875
gsm: +420 724 461 062
icq: 66842878
eml: lukas.sk...@envinet.cz, luky.sk...@gmail.com
www: http://envinet.cz




--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to