kohlschutter / junixsocket

Unix Domain Sockets in Java 7 and newer (AF_UNIX), AF_TIPC, AF_VSOCK, and more
Apache License 2.0
433 stars 114 forks source link
af-unix bsd-sockets crosscompile inter-process-communication ipc java java-sockets-api jni jni-library junixsocket mysql postgresql rmi socket sockets tipc unix-domain-socket vsock

junixsocket logo

GitHub Workflow Status (with event) Last commit on main Maven Central version Apache 2.0 Licensed

Users of junixsocket are strongly advised to upgrade to version 2.10.0 or newer (changelog)

junixsocket

junixsocket is a Java/JNI library that allows the use of Unix Domain Sockets (AF_UNIX sockets), and other address/protocol families (such as AF_TIPC, AF_VSOCK, and AF_SYSTEM), from Java.

Unix sockets API, in Java, AF.

* (Tested up to Java 24; basic support for Java 7 was dropped in version 2.5.0 and reintroduced in version 2.8.0).

Quick links

Licensing

junixsocket is released under the Apache 2.0 License.

Commercial support is available through Kohlschütter Search Intelligence.

Self-test

To verify that the software works as expected on your platform, you can run the junixsocket-selftest program, which is located in the "junixsocket-dist" distribution package, and also released on GitHub.

java -jar junixsocket-selftest-VERSION-jar-with-dependencies.jar

(with VERSION being the corresponding junixsocket version).

Maven dependency

To include the core junixsocket functionality in your project, add the following Maven dependency

NOTE Since version 2.4.0, junixsocket-core is POM-only (that's why you need to specify <type>pom</type>)

<dependency>
  <groupId>com.kohlschutter.junixsocket</groupId>
  <artifactId>junixsocket-core</artifactId>
  <version>2.10.0</version>
  <type>pom</type>
</dependency>

While you should definitely pin your dependency to a specific version, you are very much encouraged to keep updating to the most recent version. Check back frequently.

For more, optional packages (RMI, MySQL, Jetty, TIPC, VSOCK, server, Darwin, SSL, GraalVM, etc.) and Gradle instructions see here

Snapshot builds for testing

When you're testing a -SNAPSHOT version, make sure that the Sonatype snapshot repository is enabled in your POM:

<repositories>
    <repository>
        <id>sonatype.snapshots</id>
        <name>Sonatype snapshot repository</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <layout>default</layout>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

To update to the latest SNAPSHOT (which is currently not being built for every commit), run the following command from within your own project:

mvn -U dependency:resolve

or (for Gradle)

./gradlew refreshVersions