Skip to content

fiken/junixsocket

 
 

Repository files navigation

junixsocket

This project is a fork of Christian Kohlschütter's junixsocket. The original project seems to be dead, and we've been unable to get in touch with the author. This fork is compatible with pgjdbc (PostgreSQL) and contains some performance improvements.

junixsocket is a Java/JNI library that allows the use of Unix Domain Sockets (AF_UNIX sockets) from Java.

Why it's cool

  • In contrast to other implementations, junixsocket extends the Java Sockets API (java.net.Socket, java.net.SocketAddress, etc.)
  • Supports RMI over AF_UNIX
  • Can connect to local Postgresql server via Unix domain sockets (provides a PostgresqlAFUNIXSocketFactory for pgjdbc).
  • Can connect to local MySQL server via Unix domain sockets (provides a AFUNIXDatabaseSocketFactory for Connector/J).
  • Apache 2.0 licensed.

Quick start

Add the following dependencies to your project:

<dependency>
  <groupId>no.fiken.oss.junixsocket</groupId>
  <artifactId>junixsocket-common</artifactId>
  <version>1.0.2</version>
</dependency>
<dependency>
  <groupId>no.fiken.oss.junixsocket</groupId>
  <artifactId>junixsocket-native-common</artifactId>
  <version>1.0.2</version>
</dependency>

Connect to a socket:

AFUNIXSocket s = AFUNIXSocket.newInstance();
s.connect(new AFUNIXSocketAddress(new File(path)));
//Use like an ordinary socket

Licensing

It is released under the Apache 2.0 License.

Noteworthy changes

  • (2017-06-05) junixsocket 1.0.2
    • throwing SocketTimeoutException (instead of just IOException) in the case of timeouts
  • (2016-09-26) junixsocket 1.0.1
    • Restored Mac-support
    • Added PostgresqlAFUNIXSocketFactory which makes it easier to use this project with pgjdbc.
  • (2016-08-18) junixsocket 1.0.0
    • Increased performance when reading data to large byte-array (prevent array-copy)
    • Added workaround so it's possible to use this library with pgjdbc (PostgreSQL)
    • Temporarily removed Mac-support (we'll hopefully fix this in a later release)

See the commit log for details.

About

Unix Domain Sockets in Java (AF_UNIX)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 82.3%
  • C 17.2%
  • HTML 0.5%