Java 16 added Unix domain socket support to the existing SocketChannel/ServerSocketChannel API via JEP 380. This tutorial walks through creating a UnixDomainSocketAddress, opening server and client channels with StandardProtocolFamily.UNIX, binding/connecting them, and passing messages using ByteBuffer. Unix domain sockets offer advantages over TCP/IP loopback: no risk of remote connections, file-based access control, faster setup, and higher throughput. They work on Linux, macOS, and modern Windows versions, and can even be used between containers sharing a volume.

6m read timeFrom nipafx.dev
Post cover image
Table of contents
▚ Accessing a Unix Domain Socket▚ Passing Messages▚ Real-life Complexities▚ Reflection

Sort: