guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: socketpairs


From: Mike Gran
Subject: Re: socketpairs
Date: Thu, 7 Feb 2019 11:31:41 +0000 (UTC)

Unix sockets are often used to communicate between processes on the same 
machine.

Normally one process opens the socket and the other connects to it.

Both processes need to know the unix path to the socket 
for this to work and they got to open and connect in the right order.

With socketpair, a master process can make the connection and then spawn the 
child processes,
passing them the file descriptors of the sockets, so the 
child processes don't have to have any networking code.

Commonly, one of the child processes will be spawned such 
that this file descriptor is its stdout standard output port, so 
then the child just writes to standard output, and that gets sent over the 
socket. 





On Thursday, February 7, 2019, 1:37:32 AM PST, Catonano <address@hidden> wrote: 





I don't understand what socketpairs are for

The manual states:

-- Scheme Procedure: socketpair family style proto
-- C Function: scm_socketpair (family, style, proto)
    Return a pair, the ‘car’ and ‘cdr’ of which are two unnamed socket
    ports connected to each other.  The connection is full-duplex, so
    data can be transferred in either direction between the two.


and what's the point of having 2 ports connected to each other ?

what's the use case meant to be covered by this ?
What's the scenario ?


    FAMILY, STYLE and PROTO are as per ‘socket’ above.  But many
    systems only support socket pairs in the ‘PF_UNIX’ family.  Zero is
    likely to be the only meaningful value for PROTO.

Ah so many systems only support socket pairs in the PF_UNIX family

So the use case is supposedly meant to be on a single machine, not through
the network

Again, what are we talking about here ?

Thanks


reply via email to

[Prev in Thread] Current Thread [Next in Thread]