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? -- mvg, Wilfried http://www.mestdagh.biz http://www.comfortsoftware.be http://www.expertsoftware.be > -----Oorspronkelijk bericht----- > Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] > Namens Lukáš Skála > Verzonden: donderdag 18 augustus 2011 8:05 > Aan: firstname.lastname@example.org > Onderwerp: Re: [twsocket] multithread server > > hi, > I always call Receive (even if RcvdCount returns zero). When RcvdCount > returns zero then Receive returns -1 value. Is it normal? > What is property Multithreaded in TWServerSocket? Should it be set to > TRUE? In demo application property is set to FALSE and only client > sockets are set to TRUE. > > Now I have no idea where is problem with service hanging. Any idea > where > to look is welcome. > Thanks > Lukas Skala > > > Dne 17.8.2011 18:18, Wilfried Mestdagh napsal(a): > > Hi, > > > > If OnDataAvailable triggers then you have to try to receive data, > even if RcvdCount (wich is unreliable) returns 0. If you don't receive > then OnDataAvailable will be called again in a closed loop en that is > probably what happens. > > > > > -- > 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 -- 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