Transfer socket connection between programs

davisn90210 at gmail.com davisn90210 at gmail.com
Mon Nov 12 22:03:47 CET 2007


On Nov 12, 1:41 pm, JamesHoward <James.w.How... at gmail.com> 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.
>
> Thanks in advance,
> James Howard

On Unix, you can use Unix Domain Sockets to pass file descriptors
between processes.  You need to create a Unix Socket, then use sendmsg
and recvmsg to pass the file descriptor between processes.

Linux Application Development includes an example of how to do this in
section 16.4.6.  The book is available through Amazon.com at
http://www.amazon.com/Linux-Application-Development-Michael-Johnson/dp/0321219147

I'm sure you can find other examples on the internet to follow.

Hope this points you in the right direction,

--Nathan Davis




More information about the Python-list mailing list