Re: unix domain sockets vs. internet sockets

From: Peter Pentchev (roam_at_ringlet.net)
Date: 02/25/05

  • Next message: Robert Watson: "Re: unix domain sockets vs. internet sockets"
    Date: Fri, 25 Feb 2005 09:21:05 +0200
    To: Baris Simsek <simsek@enderunix.org>
    
    
    

    On Fri, Feb 25, 2005 at 09:02:45AM +0200, Baris Simsek wrote:
    > Hi,
    >
    > I am coding a daemon program. I am not sure about which type of
    > sockets i should use. Could you compare ip sockets and unix domain
    > sockets? My main criterions are performance and protocol load.

    The main point you should be thinking about is - should your daemon be
    accessible by clients running on remote machines? If so, Unix-domain
    sockets are *definitely* not what you want, since they are, by design,
    limited to connections on the same machine. This is actually what makes
    them a lot more efficient to use.

    However, it would not be too hard to write your program so it is pretty
    much independent of the type of sockets used - that's the point of the
    Berkeley *sockets* intreface :) If you drive carefully around the very
    few things you can do *only* with Unix-domain sockets (for instance,
    credential passing), and the very few things you can do *only* with
    Internet-domain sockets (e.g. accept filters), and you handle the
    address size/representation issue carefully (which in theory you should
    anyway, what with IPv6 just around the corner... it seems ;), then your
    program should have no trouble with listening on both/either type of
    socket. Actually, a lot of programs do that already, getting the best
    of both worlds - the efficiency of Unix-domain sockets for local clients
    and the ease of use of Internet-domain sockets for remote connections.

    > What are the differences between impelementations of them at kernel
    > level?

    I'll have to let someone else answer that one :)

    G'luck,
    Peter

    -- 
    Peter Pentchev	roam@ringlet.net    roam@cnsys.bg    roam@FreeBSD.org
    PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
    Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
    This sentence contains exactly threee erors.
    
    



  • Next message: Robert Watson: "Re: unix domain sockets vs. internet sockets"

    Relevant Pages