Package com.martiansoftware.nailgun
Class NGUnixDomainSocketLibrary
- java.lang.Object
-
- com.martiansoftware.nailgun.NGUnixDomainSocketLibrary
-
public class NGUnixDomainSocketLibrary extends java.lang.ObjectUtility class to bridge native Unix domain socket calls to Java using JNA.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNGUnixDomainSocketLibrary.SockaddrUnBridgesstruct sockaddr_unto and from native code.
-
Field Summary
Fields Modifier and Type Field Description static intAF_LOCALprivate static booleanHAS_SUN_LENstatic intPF_LOCALstatic intSHUT_RDstatic intSHUT_WRstatic intSOCK_STREAM
-
Constructor Summary
Constructors Modifier Constructor Description privateNGUnixDomainSocketLibrary()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intaccept(int fd, NGUnixDomainSocketLibrary.SockaddrUn address, com.sun.jna.ptr.IntByReference addressLen)static intbind(int fd, NGUnixDomainSocketLibrary.SockaddrUn address, int addressLen)static intclose(int fd)static intlisten(int fd, int backlog)static intread(int fd, java.nio.ByteBuffer buffer, int count)static intshutdown(int fd, int how)static intsocket(int domain, int type, int protocol)static intwrite(int fd, java.nio.ByteBuffer buffer, int count)
-
-
-
Field Detail
-
PF_LOCAL
public static final int PF_LOCAL
- See Also:
- Constant Field Values
-
AF_LOCAL
public static final int AF_LOCAL
- See Also:
- Constant Field Values
-
SOCK_STREAM
public static final int SOCK_STREAM
- See Also:
- Constant Field Values
-
SHUT_RD
public static final int SHUT_RD
- See Also:
- Constant Field Values
-
SHUT_WR
public static final int SHUT_WR
- See Also:
- Constant Field Values
-
HAS_SUN_LEN
private static final boolean HAS_SUN_LEN
-
-
Method Detail
-
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
public static int read(int fd, java.nio.ByteBuffer buffer, int count) throws com.sun.jna.LastErrorException- Throws:
com.sun.jna.LastErrorException
-
write
public static int write(int fd, java.nio.ByteBuffer buffer, int count) throws com.sun.jna.LastErrorException- 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
-
-