Package net.i2p.util
Class InternalServerSocket
- java.lang.Object
-
- java.net.ServerSocket
-
- net.i2p.util.InternalServerSocket
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class InternalServerSocket extends ServerSocket
A simple in-JVM ServerSocket using Piped Streams. We use port numbers just like regular sockets. Can only be connected by InternalSocket. Warning - this uses Piped Streams, which don't like multiple writers from threads that may vanish. If you do use multipe writers, you may get intermittent 'write end dead' or 'pipe broken' IOExceptions on the reader side. See http://techtavern.wordpress.com/2008/07/16/whats-this-ioexception-write-end-dead/- Since:
- 0.7.9
-
-
Constructor Summary
Constructors Constructor Description InternalServerSocket(int port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Socket
accept()
void
bind(SocketAddress endpoint)
Deprecated.unsupportedvoid
bind(SocketAddress endpoint, int backlog)
Deprecated.unsupportedvoid
close()
ServerSocketChannel
getChannel()
Returns null as of 0.9.33, prior to that threw IllegalArgumentExceptionInetAddress
getInetAddress()
Deprecated.unsupportedint
getLocalPort()
SocketAddress
getLocalSocketAddress()
Deprecated.unsupportedint
getReceiveBufferSize()
Deprecated.unsupportedboolean
getReuseAddress()
Deprecated.unsupportedint
getSoTimeout()
(package private) static void
internalConnect(int port, InternalSocket clientSock)
This is how the client connects.boolean
isBound()
Returns true as of 0.9.33, prior to that threw IllegalArgumentExceptionboolean
isClosed()
Supported as of 0.9.33, prior to that threw IllegalArgumentExceptionstatic void
renderStatusHTML(Writer out)
For debugging onlyvoid
setReceiveBufferSize(int size)
Deprecated.unsupportedvoid
setReuseAddress(boolean on)
Deprecated.unsupportedvoid
setSoTimeout(int timeout)
warning - unsupportedString
toString()
-
Methods inherited from class java.net.ServerSocket
getOption, implAccept, setOption, setPerformancePreferences, setSocketFactory, supportedOptions
-
-
-
-
Constructor Detail
-
InternalServerSocket
public InternalServerSocket(int port) throws IOException
- Parameters:
port
- > 0- Throws:
IOException
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classServerSocket
-
accept
public Socket accept() throws IOException
- Overrides:
accept
in classServerSocket
- Throws:
IOException
-
toString
public String toString()
- Overrides:
toString
in classServerSocket
-
internalConnect
static void internalConnect(int port, InternalSocket clientSock) throws IOException
This is how the client connects.- Parameters:
port
- > 0- Throws:
IOException
-
getLocalPort
public int getLocalPort()
- Overrides:
getLocalPort
in classServerSocket
-
setSoTimeout
public void setSoTimeout(int timeout)
warning - unsupported- Overrides:
setSoTimeout
in classServerSocket
-
getSoTimeout
public int getSoTimeout()
- Overrides:
getSoTimeout
in classServerSocket
-
bind
@Deprecated public void bind(SocketAddress endpoint)
Deprecated.unsupported- Overrides:
bind
in classServerSocket
-
bind
@Deprecated public void bind(SocketAddress endpoint, int backlog)
Deprecated.unsupported- Overrides:
bind
in classServerSocket
-
getChannel
public ServerSocketChannel getChannel()
Returns null as of 0.9.33, prior to that threw IllegalArgumentException- Overrides:
getChannel
in classServerSocket
-
getInetAddress
@Deprecated public InetAddress getInetAddress()
Deprecated.unsupported- Overrides:
getInetAddress
in classServerSocket
-
getLocalSocketAddress
@Deprecated public SocketAddress getLocalSocketAddress()
Deprecated.unsupported- Overrides:
getLocalSocketAddress
in classServerSocket
-
getReceiveBufferSize
@Deprecated public int getReceiveBufferSize()
Deprecated.unsupported- Overrides:
getReceiveBufferSize
in classServerSocket
-
getReuseAddress
@Deprecated public boolean getReuseAddress()
Deprecated.unsupported- Overrides:
getReuseAddress
in classServerSocket
-
isBound
public boolean isBound()
Returns true as of 0.9.33, prior to that threw IllegalArgumentException- Overrides:
isBound
in classServerSocket
-
isClosed
public boolean isClosed()
Supported as of 0.9.33, prior to that threw IllegalArgumentException- Overrides:
isClosed
in classServerSocket
-
setReceiveBufferSize
@Deprecated public void setReceiveBufferSize(int size)
Deprecated.unsupported- Overrides:
setReceiveBufferSize
in classServerSocket
-
setReuseAddress
@Deprecated public void setReuseAddress(boolean on)
Deprecated.unsupported- Overrides:
setReuseAddress
in classServerSocket
-
renderStatusHTML
public static void renderStatusHTML(Writer out) throws IOException
For debugging only- Throws:
IOException
- Since:
- 0.9.33
-
-