Using Java NIO with Unix Domains in Non-Blocking Mode Using Selectors

Is there a way to use Unix domain sockets with Java NIO? I want to use NIO so that I can use Selectors on it in a single thread.

I looked at junixsocket , but it seems to only support regular sockets, not NIO channels that support the selector.

+5
source share
2 answers

You can use the jnr-unixsocket project, ( https://github.com/jnr/jnr-unixsocket ), which is the most advanced implementation I've seen. It does what you need: nio concept Selectors, channels, etc.

Look @https://github.com/jnr/jnr-unixsocket/tree/master/src/main/java/jnr/unixsocket/example

+7
+1
source

All Articles