Package com.martiansoftware.nailgun
Class NGUnixDomainSocketLibrary
java.lang.Object
com.martiansoftware.nailgun.NGUnixDomainSocketLibrary
Utility class to bridge native Unix domain socket calls to Java using JNA.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Bridgesstruct sockaddr_un
to and from native code. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
private static final boolean
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
accept
(int fd, NGUnixDomainSocketLibrary.SockaddrUn address, com.sun.jna.ptr.IntByReference addressLen) static int
bind
(int fd, NGUnixDomainSocketLibrary.SockaddrUn address, int addressLen) static int
close
(int fd) static int
listen
(int fd, int backlog) static int
read
(int fd, ByteBuffer buffer, int count) static int
shutdown
(int fd, int how) static int
socket
(int domain, int type, int protocol) static int
write
(int fd, ByteBuffer buffer, int count)
-
Field Details
-
PF_LOCAL
public static final int PF_LOCAL- See Also:
-
AF_LOCAL
public static final int AF_LOCAL- See Also:
-
SOCK_STREAM
public static final int SOCK_STREAM- See Also:
-
SHUT_RD
public static final int SHUT_RD- See Also:
-
SHUT_WR
public static final int SHUT_WR- See Also:
-
HAS_SUN_LEN
private static final boolean HAS_SUN_LEN
-
-
Constructor Details
-
NGUnixDomainSocketLibrary
private NGUnixDomainSocketLibrary()
-
-
Method Details
-
socket
public static int socket(int domain, int type, int protocol) throws com.sun.jna.LastErrorException - Throws:
com.sun.jna.LastErrorException
-
bind
public static int bind(int fd, NGUnixDomainSocketLibrary.SockaddrUn address, int addressLen) throws com.sun.jna.LastErrorException - Throws:
com.sun.jna.LastErrorException
-
listen
public static int listen(int fd, int backlog) throws com.sun.jna.LastErrorException - Throws:
com.sun.jna.LastErrorException
-
accept
public static int accept(int fd, NGUnixDomainSocketLibrary.SockaddrUn address, com.sun.jna.ptr.IntByReference addressLen) throws com.sun.jna.LastErrorException - Throws:
com.sun.jna.LastErrorException
-
read
- Throws:
com.sun.jna.LastErrorException
-
write
- Throws:
com.sun.jna.LastErrorException
-
close
public static int close(int fd) throws com.sun.jna.LastErrorException - Throws:
com.sun.jna.LastErrorException
-
shutdown
public static int shutdown(int fd, int how) throws com.sun.jna.LastErrorException - Throws:
com.sun.jna.LastErrorException
-