Unix domain sockets: How to name them? And where to put them?

I am using unix sockets for inter-process communication in a C++/gtkmm project.
Are there naming conventions and conventions about where to place sockets in the filesystem? In all example code I found, dummies like /home/user/mysocket were being used.
If there are not any conventions: Would it be sensible to put the sockets in /tmp/ and compose the names of the name of the program which uses the concerning socket, and its PID? (The latter also depends on my use case, of course; from that point of view, it seems sensible.)

@Franek:  KDE applications place their sockets (through KDE API, of course) in "/tmp/ksocket-foo/bar__0", where "foo" is the user name, "bar" the application name and "0" an increasing counter (in case an application creates more than one socket).  Emacs places its server socket in a similar manner "/tmp/emacs1000/server", where "1000" is the UID.
I'd use emacs' name scheme, e.g. "/tmp/bar1000/what_the_socket_is_for", where "bar" is the application name again. 
However, do not place sockets directly in "/tmp/". For one thing, it just clutters this global directory, but more importantly it's unsafe, as every other user can inspect these sockets.  Create a directory within "/tmp/" and restrict its access rights to the owner (mode 700).  Thus other users can't inspect the sockets within that directory.  Of course, the access rights of the sockets themselves must also be limited.
Last edited by lunar (2011-10-12 18:59:32)

Similar Messages

  • Unix Domain Socket - Question about work around

    Since Unix Domain Sockets are platform dependent and Java is platform independent, it does not support it.
    However, I am sure some of you have worked with them and found some good work around.
    Elsewhere Jtux was suggested as a possible fix. However, I have not seen any good testimonials to it working. Also, if there are any security issues with this software. The website is here: http://www.basepath.com/aup/jtux/
    Does anyone have any other suggest?
    Thanks.

    I am modifying a current app. I must use the Unix
    Domain Sockets. I have no choice in the matters. It's
    for security reasons that they must be left in place.I can only guess that you do not understand my suggestion.
    The proxy does a domain socket to regular socket - just a pass through. You write this in C/C++.
    In your java app, as one option, you use Runtime.exec() to start the proxy. Then you use a java socket to connect to it. You can pass options to the proxy to control the socket behavior on both ends.
    In terms of usage there are a number of variations on the above.

  • Open unix domain socket (Linux)

    How do I open a unix domain socket under linux using Labview (7.1).
    I would like to write messages to /dev/log.
    thanx
    Message Edited by Dennisvr on 01-27-2006 04:20 AM

    Dennisvr wrote:
    Pipes and sockets are
    different things. At first I thougt they could be the same too, and I
    even tried opening it using the LabVIEW pipe functions, but that didn't
    work.   Look at this link, it explains how it works, even with some examples: http://www.ecst.csuchico.edu/~beej/guide/ipc/usock​.html
    I
    see. Well LabVIEW does not support this type of socket. The only socket
    interface it has already is the one used for its TCP/UDP implementation
    and that is using sockaddr_in internally to bind. As such you have two
    options:
    1) Write your own domain socket interface writing a shared library and the according interface VIs.
    2) Or use TCP/IP interprocess communication instead.
    In terms of functionality TCP/IP will be the same as what you could
    possibly get from domain sockets. The only reason to use domain sockets
    instead of TCP/IP sockets might be that domain sockets have a
    more  optimized data transfer since they do not take precautions
    for remote data transfer. If you really need this (possible?) increased
    performance you will have to do some work.
    However domain sockets seem little known and might be a new technology.
    So I would make sure it is properly supported on all the potential
    system you try to use this before taking the plunge to write your own
    shared library interface to call through the Call Library Node.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Unix Domain socket, ECONNREFUSED causes?

    I would like to have a complete list of possible causes for connect(3SOCKET) to return ECONNREFUSED. I have a pthreads application that fails a test case due to connection refused, and none of the usual causes seem to make sense.
    - socket path exists but nobody is listening on the socket - pfiles shows that the server side has the socket descriptor open
    - too many connections - pfiles and lsof show that this is not the case - very few connections open
    - wrong type of socket? debugger shows this is not the case
    - wrong file permissions on socket? ls shows that this is not the case
    What other causes for ECONNREFUSED could there be?
    thanks
    --donb                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Yes what does the term "Unix Domain Socket" refer to.
    I can think of several possibilities....
    1. It just means "socket". So you use the socket stuff.
    2. It is port specific/ip range specific, so you use the port/ip with the regular socket stuff.
    3. It is a layer in regular TCP/IP (like VPNs) so unless the layer itself is being managed a java app doesn't need to do anything.
    4. It is a different protocol (or with extended features) from a regular TCP socket. In that case you would have to write your own socket layer via JNI to handle it.

  • Client connection using UNIX Domain Socket

    Hello all,
    I am getting the following error when I try to connect from a 32-bit TimesTen client to the 64-bit TimesTen data manager via UNIX domain socket.
    NOTE: I can make SHM connections from 32-bit client to 64-bit server though.
    # ttisqlcs test_uds
    Copyright (c) 1996-2007, Oracle. All rights reserved.
    Type ? or "help" for help, type "exit" to quit ttIsql.
    All commands must end with a semicolon character.
    connect "DSN=test_uds";
    08001: Unable to connect to data source (DSN: test_uds; Network Address: ttLocalHost; Port Number: 18003). Please refer to TimesTen Server log to see if connection over UNIX domain socket is allowed at this point in time
    The command failed.
    Done.
    Both 32-bit client and 64-bit server processes run on the same box. I do not see any errors in the user or server log files.
    Entry in sys.ttconnect.ini file
    [ttLocalHost-tt_704_dev]
    Description=TimesTen Server
    Network_Address=ttLocalHost
    TCP_PORT=18003
    Entry in sys.odbc.ini file
    [test_uds]
    Driver=/ttsoft/TimesTen32/TimesTen/tt70_32/lib/libttclient.so
    TTC_SERVER=ttLocalHost-tt_704_dev
    TTC_SERVER_DSN=test
    Thanks,
    Senthil.

    Could this be bug 4950822? This was documented in the 6.0.3 Release Notes "Known Limitations" section:
    "On Unix, when using ttlocalhost, a client of one TimesTen instance cannot connect with a server of another TimesTen instance. The workaround is to use ttShmHost (shared memory IPC) or localhost (127.0.0.1)."
    The error message received matches the one you're seeing.

  • Unix Domain Socket

    Hi,
    How can Java connect to a Unix Domain Socket?
    Help please!

    Yes what does the term "Unix Domain Socket" refer to.
    I can think of several possibilities....
    1. It just means "socket". So you use the socket stuff.
    2. It is port specific/ip range specific, so you use the port/ip with the regular socket stuff.
    3. It is a layer in regular TCP/IP (like VPNs) so unless the layer itself is being managed a java app doesn't need to do anything.
    4. It is a different protocol (or with extended features) from a regular TCP socket. In that case you would have to write your own socket layer via JNI to handle it.

  • Saving a Pages document: when I first save a pages document it saves and I don't know where it goes or what its name is.  I want to be asked every time I save a pages document what to name it and where to save it. How do I set this preference?

    Saving a Pages document: when I first save a pages document it saves and I don't know where it goes or what its name is.  I want to be asked every time I save a pages document what to name it and where to save it. How do I set this preference?

    I'll guess that you've used a page layout document & pasting created a text box. You can add more pages & create linked text boxes, but I think you'd be better of using a word processing document. In word processing documents there is a basic text layer & additional pages will be created as needed to fit the text. Take a look at the toolbar of your document. If it says "sections" for the +page icon it's a word processing document, if it says "pages" it's a page layout document.

  • HT201269 Next to my songs a cloud with an arrow pointing down from each cloud appears. I assume this is from icloud? I don't want these songs onmy phone. help! How do I get rid of them and where do I go to manage this?

    Next to my songs a cloud with an arrow pointing down from each cloud appears. I assume this is from icloud? What is it?
    I don't want these songs on my phone. Help! How do I get rid of them and where do I go to manage this?

    If you're talking about itunes Match,
    Try posting in the iTunes Match forum, you'll probably find more knowledgeable folks there.
    https://discussions.apple.com/community/itunes/itunes_match

  • Hello, I have long been using Mozilla Firefoh, but I can't restore a theme (in the browser before I used the theme in anime), I do not remember how to install it and where to find, maybe it was not a topic, and skin. Please help me solve this problem.

    (in the browser before I used the theme in anime), I do not remember how to install it and where to find, maybe it was not a topic, and skin.

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • My old computer crashed so I couldnt deauthorize it, and i need to authorize my new one. how do i do it without having to deauthorize all of them and redo all of them?

    my old computer crashed so I couldnt deauthorize it, and i need to authorize my new one. how do i do it without having to deauthorize all of them and redo all of them?

    ... how do i do it without having to deauthorize all of them and redo all of them?
    This is not possible. If the old computer is unusable the only option is "deauthorize all".

  • How can I stop Lion tidying my desktop and putting all my icons in alphabetical order. I like my files to stay where I put them!

    How can I stop Lion tidying my desktop and putting all my icons in alphabetical order. I like my files to stay where I put them! Every morning I boot up and all my desktop items have been moved. How can I stop this?
    By the way - Lion is the worst 'upgrade' ever.

    Hello again:
    I've been to 'view' - and all I can see are the same options as before. Nothing which says the equivalent of 'stop Lion tidying my desktop alphabetically every time I boot up' - alas.
    Hmmm.  Try something:
    Trash a preference file (com.apple.finder.plist) and restart.  Then go to the view option while in Finder.  There should be a "show view options."  Select that and sort by "none."
    FWIW, I have had no discernable change in speed under OS X 10.7, but that is just my system.  I only use Adobe's free stuff.  Have you checked with Adobe to see if there are updates available?  I rarely use text edit so I have no benchmark.  I don't like the missing save as either  
    Barry
    P.S.  I am not being contrary - I just like to learn from the experiences of others. 

  • I am trying to import movie files into to iMovie. They are home videos so I use handbrake and VLC to put them onto the computer and convert them to MPEG-4 files. I successfully imported two of the videos but the others are not working, they are all MPEG-4

    I am trying to import movie files into to iMovie. They are home videos so I use handbrake and VLC to put them onto the computer and convert them to MPEG-4 files. I successfully imported two of the videos but the others are not working, they are all MPEG-4 files. Now, they are not compatible. How to I get them into imovie?

    Hi
    I use
    • DV-PAL or DV-NTSC - or -
    • AIC
    Yours Bengt W

  • Today I imported quite a lot of Audio CDs. When I wanted to listen to them I realised that most of them aren't in my library. And they did not appear in the recently added list either. Can anyone tell me what happened and where to find them? Thanks!

    Today I imported quite a lot of Audio CDs. When I wanted to listen to them I realised that most of them aren't in my library. And they did not appear in the recently added list either. Can anyone tell me what happened and where to find them? It's really strange because all the imorts definitely finished. Thanks!

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • How to combine insert and where query ?

    hi..
    could somebody guide me how to combine insert and where query ?
    insert into tdc_imarspc (ANUMBER,EMF_ID,PRODUCT) values ('1234567','65','ITFS')
    where anumber not like '1234567';
    Thank you,
    Baharin

    Hi, Baharin,
    As Mahesh said, WHERE only works on a query.
    You can always base a query on dual, like this:
    INSERT INTO
    tdc_imarspc (ANUMBER,     EMF_ID,     PRODUCT)
    SELECT          '1234567',     '65',     'ITFS'
    FROM         dual
    WHERE          anumber      NOT LIKE '1234567';Of course, you can use a literal, like '1234567' in both places where I used the bind variable, but if you're not using a variable, why would you want to?
    You could also put all the literals in a sub-query (based on dual), and reference column names in the main WHERE clause, LIKE THIS:
    INSERT INTO
    tdc_imarspc (     ANUMBER,     EMF_ID,          PRODUCT)
    WITH     sub_q
    AS  (
        SELECT    '1234567' AS an,     '65' AS ei,     'ITFS' AS pr
        FROM      dual
    SELECT          an,          ei,          pr
    FROM     sub_q
    WHERE      an      NOT LIKE '1234567'; 
    I assume you're not really saying
    an      NOT LIKE '1234567'If you're not using any wild cards after LIKE, you might as well use !=
    an      != '1234567'

  • I just upgraded to a new computer running Windows 7 from an old one running XP. I would like to transfer all my bookmarks but I don't know where they were and where to move them to in the new computer. Thank You.

    I just upgraded to a new computer running Windows 7 from an old one running XP. I would like to migrate my old bookmarks to the new computer but I do not know where to find them or where to migrate them to.
    I do have the old computer's disk drive.
    Thank You.

    See https://support.mozilla.com/en-US/kb/Backing%20up%20and%20restoring%20bookmarks
    and
    https://support.mozilla.com/en-US/kb/Backing%20up%20your%20information?s=new+computer&r=4&as=s#os=win&browser=fx8

Maybe you are looking for