Package com.martiansoftware.nailgun
Class NGWin32NamedPipeServerSocket
- java.lang.Object
-
- java.net.ServerSocket
-
- com.martiansoftware.nailgun.NGWin32NamedPipeServerSocket
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class NGWin32NamedPipeServerSocket extends java.net.ServerSocket
-
-
Field Summary
Fields Modifier and Type Field Description private static NGWin32NamedPipeLibrary
API
private static int
BUFFER_SIZE
private NGWin32NamedPipeSocket.CloseCallback
closeCallback
private java.util.concurrent.LinkedBlockingQueue<com.sun.jna.platform.win32.WinNT.HANDLE>
connectedHandles
private com.sun.jna.platform.win32.WinNT.HANDLE
lockHandle
private int
maxInstances
private java.util.concurrent.LinkedBlockingQueue<com.sun.jna.platform.win32.WinNT.HANDLE>
openHandles
private java.lang.String
path
private boolean
requireStrictLength
private static java.lang.String
WIN32_PIPE_PREFIX
-
Constructor Summary
Constructors Constructor Description NGWin32NamedPipeServerSocket(int maxInstances, java.lang.String path)
NGWin32NamedPipeServerSocket(int maxInstances, java.lang.String path, boolean requireStrictLength)
The doc for InputStream#read(byte[] b, int off, int len) states that "An attempt is made to read as many as len bytes, but a smaller number may be read." However, using requireStrictLength, NGWin32NamedPipeSocketInputStream can require that len matches up exactly the number of bytes to read.NGWin32NamedPipeServerSocket(java.lang.String path)
NGWin32NamedPipeServerSocket(java.lang.String path, boolean requireStrictLength)
The doc for InputStream#read(byte[] b, int off, int len) states that "An attempt is made to read as many as len bytes, but a smaller number may be read." However, using requireStrictLength, NGWin32NamedPipeSocketInputStream can require that len matches up exactly the number of bytes to read.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.Socket
accept()
void
bind(java.net.SocketAddress endpoint)
void
close()
private void
closeConnectedPipe(com.sun.jna.platform.win32.WinNT.HANDLE handle, boolean shutdown)
private void
closeOpenPipe(com.sun.jna.platform.win32.WinNT.HANDLE handle)
-
Methods inherited from class java.net.ServerSocket
bind, getChannel, getInetAddress, getLocalPort, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout, toString
-
-
-
-
Field Detail
-
API
private static final NGWin32NamedPipeLibrary API
-
WIN32_PIPE_PREFIX
private static final java.lang.String WIN32_PIPE_PREFIX
- See Also:
- Constant Field Values
-
BUFFER_SIZE
private static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
openHandles
private final java.util.concurrent.LinkedBlockingQueue<com.sun.jna.platform.win32.WinNT.HANDLE> openHandles
-
connectedHandles
private final java.util.concurrent.LinkedBlockingQueue<com.sun.jna.platform.win32.WinNT.HANDLE> connectedHandles
-
closeCallback
private final NGWin32NamedPipeSocket.CloseCallback closeCallback
-
path
private final java.lang.String path
-
maxInstances
private final int maxInstances
-
lockHandle
private final com.sun.jna.platform.win32.WinNT.HANDLE lockHandle
-
requireStrictLength
private final boolean requireStrictLength
-
-
Constructor Detail
-
NGWin32NamedPipeServerSocket
public NGWin32NamedPipeServerSocket(java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
NGWin32NamedPipeServerSocket
public NGWin32NamedPipeServerSocket(java.lang.String path, boolean requireStrictLength) throws java.io.IOException
The doc for InputStream#read(byte[] b, int off, int len) states that "An attempt is made to read as many as len bytes, but a smaller number may be read." However, using requireStrictLength, NGWin32NamedPipeSocketInputStream can require that len matches up exactly the number of bytes to read.- Throws:
java.io.IOException
-
NGWin32NamedPipeServerSocket
public NGWin32NamedPipeServerSocket(int maxInstances, java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
NGWin32NamedPipeServerSocket
public NGWin32NamedPipeServerSocket(int maxInstances, java.lang.String path, boolean requireStrictLength) throws java.io.IOException
The doc for InputStream#read(byte[] b, int off, int len) states that "An attempt is made to read as many as len bytes, but a smaller number may be read." However, using requireStrictLength, NGWin32NamedPipeSocketInputStream can require that len matches up exactly the number of bytes to read.- Throws:
java.io.IOException
-
-
Method Detail
-
bind
public void bind(java.net.SocketAddress endpoint) throws java.io.IOException
- Overrides:
bind
in classjava.net.ServerSocket
- Throws:
java.io.IOException
-
accept
public java.net.Socket accept() throws java.io.IOException
- Overrides:
accept
in classjava.net.ServerSocket
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.net.ServerSocket
- Throws:
java.io.IOException
-
closeOpenPipe
private void closeOpenPipe(com.sun.jna.platform.win32.WinNT.HANDLE handle) throws java.io.IOException
- Throws:
java.io.IOException
-
closeConnectedPipe
private void closeConnectedPipe(com.sun.jna.platform.win32.WinNT.HANDLE handle, boolean shutdown) throws java.io.IOException
- Throws:
java.io.IOException
-
-