sending socket descriptor to another pid - Networking

This is a discussion on sending socket descriptor to another pid - Networking ; Folks, Socket(2) returns a file descriptor, used to send, write or read data from the socket. A process calling socket can successfully create the socket. I found there is a way to send the socket file descriptor to another process ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: sending socket descriptor to another pid

  1. sending socket descriptor to another pid

    Folks,

    Socket(2) returns a file descriptor, used to send, write or read data
    from the socket. A process calling socket can successfully create the
    socket. I found there is a way to send the socket file descriptor to
    another process and be able to read and write data as if it were the
    original pid via the sendmsg call. I am now looking for examples on
    how to write up a simple test case. Any pointers?

    Thanks,
    BEA

  2. Re: sending socket descriptor to another pid

    Beagle wrote:
    > Folks,
    >
    > Socket(2) returns a file descriptor, used to send, write or read data
    > from the socket. A process calling socket can successfully create the
    > socket. I found there is a way to send the socket file descriptor to
    > another process and be able to read and write data as if it were the
    > original pid via the sendmsg call. I am now looking for examples on
    > how to write up a simple test case. Any pointers?
    >
    > Thanks,
    > BEA



    I guess that it is impossible because someone file descriptor of a
    process is is invalid in other process. The kernel uses two tables of
    resources. The first table connects descriptors of process with
    descriptors of kernel table. The second table is general for the kernel.

    Daneel

  3. Re: sending socket descriptor to another pid

    Discovered a truly amazing book (again) which goes into depth
    explaining and provides source code delivering exactly the result I
    was after (WOW).

    Advanced Programming in the UNIX Environment, Second Edition, Chapter
    17, Advanced IPC, Section 17.6. An Open Server, Version 2

    http://www.apuebook.com

    Others had referenced the Linux kernel, net/core/scm.c


    On Jul 8, 11:28 am, Daneel Yaitskov wrote:
    > Beagle wrote:
    > > Folks,

    >
    > > Socket(2) returns a file descriptor, used to send, write or read data
    > > from the socket. A process calling socket can successfully create the
    > > socket. I found there is a way to send the socket file descriptor to
    > > another process and be able to read and write data as if it were the
    > > original pid via the sendmsg call. I am now looking for examples on
    > > how to write up a simple test case. Any pointers?

    >
    > > Thanks,
    > > BEA

    >
    > I guess that it is impossible because someone file descriptor of a
    > process is is invalid in other process. The kernel uses two tables of
    > resources. The first table connects descriptors of process with
    > descriptors of kernel table. The second table is general for the kernel.
    >
    > Daneel



+ Reply to Thread