Hello once again, I finally put the part of the code that was consuming the biggest part of the resources in a thread. Now I have a form which has TWSocket server and reads the clients data, When this data is something "special" it calls a thread to do the parsing. My problem: when the thread it's called it consumes the system resources and the client's data received meanwhile is discarded. Can anybody tell me a way of putting the thread to work only when there is no data? Thank you once again João
-----Mensagem original----- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Em nome de João Gonçalves Enviada: segunda-feira, 15 de Outubro de 2007 12:32 Para: 'ICS support mailing' Assunto: Re: [twsocket] problem with TCP server Hello, I have to use linemode to false, since the server receives data from independent hardware modules. If I put it to true, I receive a character at a time. My problem is that the processing of some data takes a quite amount of time, and the server doesn´t processes the data, Is there any way of solving this problem? Thanks Best regards João -----Mensagem original----- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Em nome de DZ-Jay Enviada: segunda-feira, 15 de Outubro de 2007 11:12 Para: ICS support mailing Assunto: Re: [twsocket] problem with TCP server On Oct 15, 2007, at 05:56, João Gonçalves wrote: > I'm using these parameters: > ((TTcpSrvClient *)Client)->LineMode = FALSE;// > ((TTcpSrvClient *)Client)->LineEdit = TRUE; > ((TTcpSrvClient *)Client)->OnDataAvailable = ClientDataAvailable; > ((TTcpSrvClient *)Client)->OnBgException = ClientBgException; > ((TTcpSrvClient *)Client)->ConnectTime = Now(); If you set LineMode=True, the OnDataAvailable event will trigger when the entire data is received (and the line-delimiter is found). I think this is what you want. Otherwise, it will trigger whenever the buffer is full and there is *some* data, and it is up to you to piece it together (this is what you have now). That last one is intended for "streaming", where you are not expecting a specific "line" of data, but a constant stream of data. If you are sending commands, like other common Internet protocols, then you should set LineMode to True. The default line-delimiter is #13#10 (CarriageReturn+LineFeed), like other Internet protocols, but you can set it to whatever you want. You also should set the LineLimit property to the maximum allowed length of a line, otherwise your server may be vulnerable to DoS attacks (since it will continue growing a buffer if no delimiter is sent, and all memory may be consumed). When the LineLimit maximum is reached, an exception is triggered (which you can handle in OnLineLimitExceeded event). dZ. -- DZ-Jay [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
