Transfer socket connection between programs

Laszlo Nagy gandalf at shopzeus.com
Mon Nov 12 15:37:49 EST 2007


JamesHoward wrote:
> Does anyone know any method to have one program, acting as a server
> transfer a socket connection to another program?  I looked into
> transferring the connection via xml rpc to no avail.  It seems to be a
> problem of getting access to a programs private memory space and
> giving another program access to that space.
>   
If you are using UNIX, you can create a pipe in the filesystem, and 
connect I/O on both ends. Of course this is not the same, because - for 
example - you cannot use setsockopt. But it works with already existing 
processes very well, and usually you can setup socket options in your 
server.

Under windows, I have no clue. It may be possible to use pipes under 
Windows but I don't know how. You can also use other nasty techniques, 
like loading a DLL into your "another program", then make a code hook 
into your server. Brrrrrrr. :-) (Unstable, not portable even between 
Windows versions...)

Regards,

   Laszlo





More information about the Python-list mailing list