Transfer socket connection between programs

Grant Edwards grante at visi.com
Mon Nov 12 15:23:49 EST 2007


On 2007-11-12, JamesHoward <James.w.Howard at gmail.com> wrote:

>> Private memory has nothing to do with it.  The connection is a
>> data structure that lives in kernel space, not in user space.
>> Even if you could grant another process access to your "private
>> memory space", it wouldn't help you "transfer a socket
>> connection", since that connection is something the OSes
>> manages.

> Does this mean that there is some way to transfer a pointer to that
> kernel memory space from one program to another and have it be valid,

No.

> or is that kernel memory space protected and unusable from other
> processes?

On Linux (I'm not sure how it works on Windows), there is a
table of file descriptors that the kernel keeps for each
process.  A table entry can be an open file on disk, a serial
port, a network connection, etc.

A file descriptor is just an index into that table. That table
can't be accessed by any other processes.  When you fork a
process the new process inherits a copy of that table (and
therefore inherits any open network connections).

-- 
Grant Edwards                   grante             Yow! I'm having an
                                  at               EMOTIONAL OUTBURST!!  But,
                               visi.com            uh, WHY is there a WAFFLE
                                                   in my PAJAMA POCKET??



More information about the Python-list mailing list