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 Socketaccept()voidbind(SocketAddress endpoint)Deprecated.unsupportedvoidbind(SocketAddress endpoint, int backlog)Deprecated.unsupportedvoidclose()ServerSocketChannelgetChannel()Returns null as of 0.9.33, prior to that threw IllegalArgumentExceptionInetAddressgetInetAddress()Deprecated.unsupportedintgetLocalPort()SocketAddressgetLocalSocketAddress()Deprecated.unsupportedintgetReceiveBufferSize()Deprecated.unsupportedbooleangetReuseAddress()Deprecated.unsupportedintgetSoTimeout()(package private) static voidinternalConnect(int port, InternalSocket clientSock)This is how the client connects.booleanisBound()Returns true as of 0.9.33, prior to that threw IllegalArgumentExceptionbooleanisClosed()Supported as of 0.9.33, prior to that threw IllegalArgumentExceptionstatic voidrenderStatusHTML(Writer out)For debugging onlyvoidsetReceiveBufferSize(int size)Deprecated.unsupportedvoidsetReuseAddress(boolean on)Deprecated.unsupportedvoidsetSoTimeout(int timeout)warning - unsupportedStringtoString()-
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classServerSocket
-
accept
public Socket accept() throws IOException
- Overrides:
acceptin classServerSocket- Throws:
IOException
-
toString
public String toString()
- Overrides:
toStringin classServerSocket
-
internalConnect
static void internalConnect(int port, InternalSocket clientSock) throws IOExceptionThis is how the client connects.- Parameters:
port- > 0- Throws:
IOException
-
getLocalPort
public int getLocalPort()
- Overrides:
getLocalPortin classServerSocket
-
setSoTimeout
public void setSoTimeout(int timeout)
warning - unsupported- Overrides:
setSoTimeoutin classServerSocket
-
getSoTimeout
public int getSoTimeout()
- Overrides:
getSoTimeoutin classServerSocket
-
bind
@Deprecated public void bind(SocketAddress endpoint)
Deprecated.unsupported- Overrides:
bindin classServerSocket
-
bind
@Deprecated public void bind(SocketAddress endpoint, int backlog)
Deprecated.unsupported- Overrides:
bindin classServerSocket
-
getChannel
public ServerSocketChannel getChannel()
Returns null as of 0.9.33, prior to that threw IllegalArgumentException- Overrides:
getChannelin classServerSocket
-
getInetAddress
@Deprecated public InetAddress getInetAddress()
Deprecated.unsupported- Overrides:
getInetAddressin classServerSocket
-
getLocalSocketAddress
@Deprecated public SocketAddress getLocalSocketAddress()
Deprecated.unsupported- Overrides:
getLocalSocketAddressin classServerSocket
-
getReceiveBufferSize
@Deprecated public int getReceiveBufferSize()
Deprecated.unsupported- Overrides:
getReceiveBufferSizein classServerSocket
-
getReuseAddress
@Deprecated public boolean getReuseAddress()
Deprecated.unsupported- Overrides:
getReuseAddressin classServerSocket
-
isBound
public boolean isBound()
Returns true as of 0.9.33, prior to that threw IllegalArgumentException- Overrides:
isBoundin classServerSocket
-
isClosed
public boolean isClosed()
Supported as of 0.9.33, prior to that threw IllegalArgumentException- Overrides:
isClosedin classServerSocket
-
setReceiveBufferSize
@Deprecated public void setReceiveBufferSize(int size)
Deprecated.unsupported- Overrides:
setReceiveBufferSizein classServerSocket
-
setReuseAddress
@Deprecated public void setReuseAddress(boolean on)
Deprecated.unsupported- Overrides:
setReuseAddressin classServerSocket
-
renderStatusHTML
public static void renderStatusHTML(Writer out) throws IOException
For debugging only- Throws:
IOException- Since:
- 0.9.33
-
-