Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29900

Re: java unix domain sockets ... or substitute

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!newsfeed.CARNet.hr!garrison.bnet.hr!gregory.BNet.hr!not-for-mail
From Josip Almasi <joe@vrspace.org>
Newsgroups comp.lang.java.programmer
Subject Re: java unix domain sockets ... or substitute
Date Thu, 04 Sep 2014 09:45:53 +0200
Organization B.net Hrvatska d.o.o.
Lines 54
Message-ID <lu95bh$8r9$1@gregory.bnet.hr> (permalink)
References <slrnm0ejqn.fp3.avl@login.logic.tuwien.ac.at>
NNTP-Posting-Host cpe-94-253-156-34.zg.cable.xnet.hr
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace gregory.bnet.hr 1409816753 9065 94.253.156.34 (4 Sep 2014 07:45:53 GMT)
X-Complaints-To abuse@globalnet.hr
NNTP-Posting-Date Thu, 4 Sep 2014 07:45:53 +0000 (UTC)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0
In-Reply-To <slrnm0ejqn.fp3.avl@login.logic.tuwien.ac.at>
Xref csiph.com comp.lang.java.programmer:29900

Show key headers only | View raw


On 09/03/2014 07:26 PM, Andreas Leitgeb wrote:
> I've googled for the terms java unix domain sockets, and it seems like
> this cannot be done with plain Java (and its JSL) alone.
>
> There are a few 3rd party libs (junixsocket & JUDS) which unfortunately
> both need native libs, which is a non-starter for me.
>
> My current approach is to use named pipes intead, where the server
> blockingly reads on a "main" pipe (opened just like a plain file).
>
> Clients first create a new pair of named pipes, and pass the names to
> the server, who in response creates a new thread to communicate over
> those pipes and serve client's task that way.
>
> This is somewhat awkward (especially cleaning up of stale named pipes),
> and named pipes do not prohibit two readers erroneously on the same pipe.
>
> I wonder, if there is:
>
>   - a new way to do unix domain sockets in Java (that google doesn't yet
>      find, or only for non-obvious-to-me keyword).  This also includes
>      solutions that involve execution of standard unix tools, just no JNI.
>
>   - a way to negotiate a bidirectional channel between a client and
>      the server that doesn't involve creating pipe nodes in the
>      filesystem.
>
> The client is non-Java, but otherwise quite flexible.
>
> I don't want to use inet sockets (not even localhost), because not every
> user on that machine should be able to connect, and I don't want to stick
> any authorization stuff into the protocol.

IMHO domain sockets are not in java for good reason - they add little 
value over pipes when used locally, but add complexity, as it's easier 
to work with files/pipes than sockets.
Also, pipes and sockets use the same auth mechanism - filesystem 
permissions.
With domain sockets you'd also get filesystem nodes, just not two for 
each client, with less bookkeeping of stale nodes.
Then again, you also can create pipes in /tmp, and leave cleanup to system.

Now, if you want to utilize local auth, simply put your client 
executable in a specific group, set permissions to dissallow anyone 
outside that group to run it, and add only users allowed into that group.
Then it's all the same which IPC mechanism you use.

But look: either you use local IPC and auth, or you use remote IPC and 
auth mechanisms.
In my experience, it's always better to start with remote IPC used locally.
Like, maybe you host becomes cluster, then your server and client become 
cluster services, with no local IPC.

Regards...

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-03 17:26 +0000
  Re: java unix domain sockets ... or substitute Wayne <nospam@all.invalid> - 2014-09-03 13:36 -0400
    Re: java unix domain sockets ... or substitute Fredrik Jonson <fredrik@jonson.org> - 2014-09-04 07:42 +0000
    Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-04 07:52 +0000
  Re: java unix domain sockets ... or substitute Josip Almasi <joe@vrspace.org> - 2014-09-04 09:45 +0200
    Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-04 09:14 +0000
      Re: java unix domain sockets ... or substitute Josip Almasi <joe@vrspace.org> - 2014-09-05 10:20 +0200
  Re: java unix domain sockets ... or substitute Fredrik Jonson <fredrik@jonson.org> - 2014-09-04 08:34 +0000
    Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-05 01:06 +0000
  Re: java unix domain sockets ... or substitute Nigel Wade <nmw@ion.le.ac.uk> - 2014-09-04 11:35 +0100
  Re: java unix domain sockets ... or substitute "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-09-04 15:11 +0100
    Re: java unix domain sockets ... or substitute Nigel Wade <nmw@ion.le.ac.uk> - 2014-09-04 15:57 +0100
      Re: java unix domain sockets ... or substitute "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-09-04 16:21 +0100
        Re: java unix domain sockets ... or substitute Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-05 10:55 +0000
  Re: java unix domain sockets ... or substitute (SOLVED) Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-09-05 00:53 +0000
    Re: java unix domain sockets ... or substitute (SOLVED) Josip Almasi <joe@vrspace.org> - 2014-09-05 10:23 +0200

csiph-web