Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Unix domain sockets from Java/Scala?

What's the best way of using Unix domain sockets from Scala?

I've found a Java library called JUDS, but it doesn't appear to allow me to send file descriptors over the socket --- the reason I want to use Unix domain sockets in the first place.

The JUDS readme refers to a competing library called J-BUDS, but I cannot find this anywhere.

I could add the feature to JUDS myself, but I'd rather I'd rather not reinvent the wheel if it's already in a jar file elsewhere.

like image 799
dave4420 Avatar asked May 01 '11 15:05

dave4420


People also ask

How do UNIX domain sockets work?

Unix sockets are a form of communication between two processes that appears as a file on disk. This file can be used by other programs to establish very fast connections between two or more processes without any network overhead.

Where should I put Unix sockets?

They are to be stored in /run/ according to the Filesystem Hierarchy Standard (FHS).

What is UNIX domain socket path?

UNIX domain sockets are named with UNIX paths. For example, a socket might be named /tmp/foo. UNIX domain sockets communicate only between processes on a single host.


1 Answers

http://download.oracle.com/javase/6/docs/api/java/net/Socket.html

By "file descriptors" do you mean objects of the class java.util.File? ...or C-style "FILE *"? (IIRC)

The latter would be tied to the particular instance of the OS, so I wouldn't think you would want to move that to (possibly) another machine.

like image 181
Chris Avatar answered Sep 21 '22 19:09

Chris