Package net.i2p.util
Class InternalSocket
java.lang.Object
java.net.Socket
net.i2p.util.InternalSocket
- All Implemented Interfaces:
Closeable,AutoCloseable
A simple in-JVM Socket using Piped Streams.
We use port numbers just like regular sockets.
Can only connect to InternalServerSocket.
- Since:
- 0.7.9
-
Constructor Summary
ConstructorsConstructorDescriptionInternalSocket(int port) client sideInternalSocket(InputStream is, OutputStream os) server side -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(SocketAddress endpoint) Deprecated.unsupportedvoidclose()voidconnect(SocketAddress endpoint) Deprecated.unsupportedvoidconnect(SocketAddress endpoint, int timeout) Deprecated.unsupportedDeprecated.unsupportedDeprecated.unsupportedbooleanDeprecated.unsupportedDeprecated.unsupportedintSupported as of 0.9.33, prior to that threw UnsupportedOperationExceptionDeprecated.unsupportedbooleanDeprecated.unsupportedintgetPort()Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionintDeprecated.unsupportedDeprecated.unsupportedbooleanDeprecated.unsupportedintDeprecated.unsupportedstatic SocketConvenience method to return either a Socket or an InternalSocketintSupported as of 0.9.33, prior to that threw UnsupportedOperationExceptionintAlways returns 0, even if setSoTimeout() was called.booleanDeprecated.unsupportedintDeprecated.unsupportedbooleanisBound()Deprecated.unsupportedbooleanisClosed()booleanSupported as of 0.9.33, prior to that threw UnsupportedOperationExceptionbooleanSupported as of 0.9.33, prior to that threw UnsupportedOperationExceptionbooleanSupported as of 0.9.33, prior to that threw UnsupportedOperationExceptionvoidsendUrgentData(int data) Deprecated.unsupported(package private) voidvoidsetKeepAlive(boolean on) Deprecated.unsupportedvoidsetOOBInline(boolean on) Deprecated.unsupported(package private) voidvoidsetReceiveBufferSize(int size) Deprecated.unsupportedvoidsetReuseAddress(boolean on) Deprecated.unsupportedvoidsetSendBufferSize(int size) Deprecated.unsupportedvoidsetSoLinger(boolean on, int linger) Does nothing as of 0.9.33, prior to that threw UnsupportedOperationExceptionvoidsetSoTimeout(int timeout) Supported as of 0.9.34, if constructed with TimeoutPipedInputStream and TimeoutPipedOutputStream.voidsetTcpNoDelay(boolean on) Deprecated.unsupportedvoidsetTrafficClass(int cize) Deprecated.unsupportedvoidSupported as of 0.9.33, prior to that threw UnsupportedOperationExceptionvoidFlushes (as the Socket javadocs advise) and closes.toString()Methods inherited from class java.net.Socket
getOption, setOption, setPerformancePreferences, setSocketImplFactory, supportedOptions
-
Constructor Details
-
InternalSocket
InternalSocket(InputStream is, OutputStream os) server side -
InternalSocket
client side- Parameters:
port- > 0- Throws:
IOException
-
-
Method Details
-
getSocket
Convenience method to return either a Socket or an InternalSocket- Parameters:
port- > 0- Throws:
IOException
-
getInputStream
- Overrides:
getInputStreamin classSocket
-
getOutputStream
- Overrides:
getOutputStreamin classSocket
-
setInputStream
-
setOutputStream
-
close
public void close() -
isClosed
public boolean isClosed() -
toString
-
setSoTimeout
public void setSoTimeout(int timeout) Supported as of 0.9.34, if constructed with TimeoutPipedInputStream and TimeoutPipedOutputStream. Otherwise, does nothing.- Overrides:
setSoTimeoutin classSocket- See Also:
-
getSoTimeout
public int getSoTimeout()Always returns 0, even if setSoTimeout() was called.- Overrides:
getSoTimeoutin classSocket
-
bind
Deprecated.unsupported -
connect
Deprecated.unsupported -
connect
Deprecated.unsupported -
getChannel
Deprecated.unsupported- Overrides:
getChannelin classSocket
-
getInetAddress
Deprecated.unsupported- Overrides:
getInetAddressin classSocket
-
getKeepAlive
Deprecated.unsupported- Overrides:
getKeepAlivein classSocket
-
getLocalAddress
Deprecated.unsupported- Overrides:
getLocalAddressin classSocket
-
getLocalPort
public int getLocalPort()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
getLocalPortin classSocket- Returns:
- 1 if connected, -1 if not
-
getLocalSocketAddress
Deprecated.unsupported- Overrides:
getLocalSocketAddressin classSocket
-
getOOBInline
Deprecated.unsupported- Overrides:
getOOBInlinein classSocket
-
getPort
public int getPort()Supported as of 0.9.33, prior to that threw UnsupportedOperationException -
getReceiveBufferSize
Deprecated.unsupported- Overrides:
getReceiveBufferSizein classSocket
-
getRemoteSocketAddress
Deprecated.unsupported- Overrides:
getRemoteSocketAddressin classSocket
-
getReuseAddress
Deprecated.unsupported- Overrides:
getReuseAddressin classSocket
-
getSendBufferSize
Deprecated.unsupported- Overrides:
getSendBufferSizein classSocket
-
getSoLinger
public int getSoLinger()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
getSoLingerin classSocket- Returns:
- -1 always
-
getTcpNoDelay
Deprecated.unsupported- Overrides:
getTcpNoDelayin classSocket
-
getTrafficClass
Deprecated.unsupported- Overrides:
getTrafficClassin classSocket
-
isBound
Deprecated.unsupported -
isConnected
public boolean isConnected()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
isConnectedin classSocket
-
isInputShutdown
public boolean isInputShutdown()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
isInputShutdownin classSocket
-
isOutputShutdown
public boolean isOutputShutdown()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
isOutputShutdownin classSocket
-
sendUrgentData
Deprecated.unsupported- Overrides:
sendUrgentDatain classSocket
-
setKeepAlive
Deprecated.unsupported- Overrides:
setKeepAlivein classSocket
-
setOOBInline
Deprecated.unsupported- Overrides:
setOOBInlinein classSocket
-
setReceiveBufferSize
Deprecated.unsupported- Overrides:
setReceiveBufferSizein classSocket
-
setReuseAddress
Deprecated.unsupported- Overrides:
setReuseAddressin classSocket
-
setSendBufferSize
Deprecated.unsupported- Overrides:
setSendBufferSizein classSocket
-
setSoLinger
public void setSoLinger(boolean on, int linger) Does nothing as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
setSoLingerin classSocket
-
setTcpNoDelay
Deprecated.unsupported- Overrides:
setTcpNoDelayin classSocket
-
setTrafficClass
Deprecated.unsupported- Overrides:
setTrafficClassin classSocket
-
shutdownInput
Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
shutdownInputin classSocket- Throws:
IOException
-
shutdownOutput
Flushes (as the Socket javadocs advise) and closes. Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
shutdownOutputin classSocket- Throws:
IOException
-