I thought I sent this last week, but I used the wrong account, anyway:

This example is not "multi-threaded", but it handles multiple
connections. The basic API are ns_socklisten, ns_sockaccept and
ns_sockcheck. (http://rmadilo.com/files/nsapi/)

The example also uses ns_socklistencallback, but the code is very
cryptic. Basically the client contacts the server with a contact
address/port then creates a server to listen for updates (server
push).

The server uses ns_socklistencallback but avoids hanging in a single
thread because it just gets the contact information and starts a
scheduled proc to handle the recurring request (push).

The scheduled proc contacts the client on the given schedule and
pushes the requested data.

The client could actually handle requests from multiple servers by
using ns_socklisten/accept:

http://www.junom.com/gitweb/gitweb.perl?p=3Dtwt.git;a=3Dtree;f=3Dpackages/tclbean/tcl;h=3D8f0100

tom jackson


On Tue, Aug 18, 2009 at 5:56 AM, Nikolay Shulga<nikolay.shu...@runway.lv> w=
rote:
> Hello,
>
> Is it possible to use Aolserver as multithreaded TCL socket server ?
>
> If I connect to Aolserver using telnet , the server waits one of HTTP
> comands from me. But it would be good to have full access to the socket ,
> from TCL script, without being obliged to send HTTP GET or other requests=
.
>
> ns_register_proc - unfortunately doesn't give such a possibility, I can h=
ave
> access to the socket but only after HTTP request has been sent.
>
> ns_socklistencallback - it gives full controll over the channell , but
> process only one client at the moment. It will accept connections from
> several clients, but will process only the first one. The others will blo=
ck
> untill the first one will disconnect.
>
> Please , if anyone knows the solution for this, share it with me .


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to