John,

I tried to do this once, for similar reasons. When a connection closes, all 
open files are closed. I'm not sure of any better way to run the server: if 
you don't have automatic code closing open files, then you run the risk of an 
error leaving your file open, and then you might screw up future use of that 
file from the other threads. I don't think it is the variable which 
references the socket which is necessarily lost, but the open file itself. 
(Otherwise you could just save the file reference in an nsv, or like you did 
with a namespace var.)

The way to do this now is with nsproxy, but I haven't used it yet, so I can't 
offer much in the way of details or limitations.

I think I remember looking at another potential method: named pipes, or 
another method of IPC. But none are out of the box supported, but some form 
of pipe is in the AOLserver C library.

I was hoping that the nsdci module would include some better tools for this, 
but just guessing. 

tom jackson

On Wednesday 06 September 2006 21:58, John Buckman wrote:
> I'd like to keep a permanently connected socket connection to another
> machine, with each aolserver thread having a socket that is already
> connected to that other app.
>
> I tried using the namespace trick to keep a global around, like so:
>
> namespace eval sbuff {}
> proc mysockget {} {
>      global sbuff:mysock
>      if {[info exists mysock] == 1} {
>          return $mysock
>      }
>      set mysock [socket localhost 9999]
> }
>
> but while the socket descriptor stays around with this trick,
> aolserver automatically closes the socket itself.  This must be some
> sort of cleanup code in aolserver, normally a good thing.
>
> Is there a way to either:
> 1) have my socket NOT be cleaned up by aolserver
> 2) have a connected socket pool, like nsdb, but w/o any functionality
> other than a connected socket
>
> I'm not alone with this need, I know that Rusty needs to do this too,
> and lots of tcpip socket protocols have login steps, that cause a new-
> connection-per-adp-page strategy to be inefficient.
>
> -john
>
>
> --
> AOLserver - http://www.aolserver.com/
>
> To Remove yourself from this list, simply send an email to
> <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the
> email message. You can leave the Subject: field of your email blank.


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

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to