Package net.i2p.util
Class InternalServerSocket
java.lang.Object
java.net.ServerSocket
net.i2p.util.InternalServerSocket
- All Implemented Interfaces:
Closeable
,AutoCloseable
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
-
Method Summary
Modifier and TypeMethodDescriptionaccept()
void
bind
(SocketAddress endpoint) Deprecated.unsupportedvoid
bind
(SocketAddress endpoint, int backlog) Deprecated.unsupportedvoid
close()
Returns null as of 0.9.33, prior to that threw IllegalArgumentExceptionDeprecated.unsupportedint
Deprecated.unsupportedint
Deprecated.unsupportedboolean
Deprecated.unsupportedint
(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 - unsupportedtoString()
Methods inherited from class java.net.ServerSocket
getOption, implAccept, setOption, setPerformancePreferences, setSocketFactory, supportedOptions
-
Constructor Details
-
InternalServerSocket
- Parameters:
port
- > 0- Throws:
IOException
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classServerSocket
-
accept
- Overrides:
accept
in classServerSocket
- Throws:
IOException
-
toString
- Overrides:
toString
in classServerSocket
-
internalConnect
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.unsupported- Overrides:
bind
in classServerSocket
-
bind
Deprecated.unsupported- Overrides:
bind
in classServerSocket
-
getChannel
Returns null as of 0.9.33, prior to that threw IllegalArgumentException- Overrides:
getChannel
in classServerSocket
-
getInetAddress
Deprecated.unsupported- Overrides:
getInetAddress
in classServerSocket
-
getLocalSocketAddress
Deprecated.unsupported- Overrides:
getLocalSocketAddress
in classServerSocket
-
getReceiveBufferSize
Deprecated.unsupported- Overrides:
getReceiveBufferSize
in classServerSocket
-
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.unsupported- Overrides:
setReceiveBufferSize
in classServerSocket
-
setReuseAddress
Deprecated.unsupported- Overrides:
setReuseAddress
in classServerSocket
-
renderStatusHTML
For debugging only- Throws:
IOException
- Since:
- 0.9.33
-