Hello, I will explain better my doubt. I need to program a multithread server that processes requests of several clients at the same time. At the moment the server processes requests of several clients one to one by the OnReceive callback:<br>
<br>procedure TConnectionHandler.Receive(aSocket: TLSocket);<br>var<br> Message: String;<br>begin<br> if aSocket.GetMessage(Message) > 0 then<br> MessagesManager.ProcessMessage(Message);<br>end;<br><br>I want to change the behavior of the server so that it works with one thread for each client request.<br>
<br>Is it possible?<br><br>Best regards.<br><br><div class="gmail_quote">2009/4/18 Aleš Katona <span dir="ltr"><<a href="mailto:almindor@gmail.com">almindor@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Thu, 16 Apr 2009 20:01:57 +0200<br>
User <<a href="mailto:usuarioanonimomysql@gmail.com">usuarioanonimomysql@gmail.com</a>> wrote:<br>
<br>
> How I can use several threads with lNet visual library?<br>
><br>
> I need some examples.<br>
><br>
> Best regards!<br>
<br>
</div></div>Hello. lNet is inheritedly not thread-safe but it can be used with threads in some ways. When it comes to the visual components, you must remember that the main program loop (handled by the widgetsets) calls the lNet callbacks (OnReceive etc.) so they are all executed inside the main thread no matter where you work with the components otherwise.<br>
<br>
I'd need some specific use case to give more info.<br>
<br>
Ales<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a><br>
<a href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</blockquote></div><br>