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
ConstructorDescriptionInternalSocket
(int port) client sideInternalSocket
(InputStream is, OutputStream os) server side -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(SocketAddress endpoint) Deprecated.unsupportedvoid
close()
void
connect
(SocketAddress endpoint) Deprecated.unsupportedvoid
connect
(SocketAddress endpoint, int timeout) Deprecated.unsupportedDeprecated.unsupportedDeprecated.unsupportedboolean
Deprecated.unsupportedDeprecated.unsupportedint
Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionDeprecated.unsupportedboolean
Deprecated.unsupportedint
getPort()
Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionint
Deprecated.unsupportedDeprecated.unsupportedboolean
Deprecated.unsupportedint
Deprecated.unsupportedstatic Socket
Convenience method to return either a Socket or an InternalSocketint
Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionint
Always returns 0, even if setSoTimeout() was called.boolean
Deprecated.unsupportedint
Deprecated.unsupportedboolean
isBound()
Deprecated.unsupportedboolean
isClosed()
boolean
Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionboolean
Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionboolean
Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionvoid
sendUrgentData
(int data) Deprecated.unsupported(package private) void
void
setKeepAlive
(boolean on) Deprecated.unsupportedvoid
setOOBInline
(boolean on) Deprecated.unsupported(package private) void
void
setReceiveBufferSize
(int size) Deprecated.unsupportedvoid
setReuseAddress
(boolean on) Deprecated.unsupportedvoid
setSendBufferSize
(int size) Deprecated.unsupportedvoid
setSoLinger
(boolean on, int linger) Does nothing as of 0.9.33, prior to that threw UnsupportedOperationExceptionvoid
setSoTimeout
(int timeout) Supported as of 0.9.34, if constructed with TimeoutPipedInputStream and TimeoutPipedOutputStream.void
setTcpNoDelay
(boolean on) Deprecated.unsupportedvoid
setTrafficClass
(int cize) Deprecated.unsupportedvoid
Supported as of 0.9.33, prior to that threw UnsupportedOperationExceptionvoid
Flushes (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:
getInputStream
in classSocket
-
getOutputStream
- Overrides:
getOutputStream
in 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:
setSoTimeout
in classSocket
- See Also:
-
getSoTimeout
public int getSoTimeout()Always returns 0, even if setSoTimeout() was called.- Overrides:
getSoTimeout
in classSocket
-
bind
Deprecated.unsupported -
connect
Deprecated.unsupported -
connect
Deprecated.unsupported -
getChannel
Deprecated.unsupported- Overrides:
getChannel
in classSocket
-
getInetAddress
Deprecated.unsupported- Overrides:
getInetAddress
in classSocket
-
getKeepAlive
Deprecated.unsupported- Overrides:
getKeepAlive
in classSocket
-
getLocalAddress
Deprecated.unsupported- Overrides:
getLocalAddress
in classSocket
-
getLocalPort
public int getLocalPort()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
getLocalPort
in classSocket
- Returns:
- 1 if connected, -1 if not
-
getLocalSocketAddress
Deprecated.unsupported- Overrides:
getLocalSocketAddress
in classSocket
-
getOOBInline
Deprecated.unsupported- Overrides:
getOOBInline
in classSocket
-
getPort
public int getPort()Supported as of 0.9.33, prior to that threw UnsupportedOperationException -
getReceiveBufferSize
Deprecated.unsupported- Overrides:
getReceiveBufferSize
in classSocket
-
getRemoteSocketAddress
Deprecated.unsupported- Overrides:
getRemoteSocketAddress
in classSocket
-
getReuseAddress
Deprecated.unsupported- Overrides:
getReuseAddress
in classSocket
-
getSendBufferSize
Deprecated.unsupported- Overrides:
getSendBufferSize
in classSocket
-
getSoLinger
public int getSoLinger()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
getSoLinger
in classSocket
- Returns:
- -1 always
-
getTcpNoDelay
Deprecated.unsupported- Overrides:
getTcpNoDelay
in classSocket
-
getTrafficClass
Deprecated.unsupported- Overrides:
getTrafficClass
in classSocket
-
isBound
Deprecated.unsupported -
isConnected
public boolean isConnected()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
isConnected
in classSocket
-
isInputShutdown
public boolean isInputShutdown()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
isInputShutdown
in classSocket
-
isOutputShutdown
public boolean isOutputShutdown()Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
isOutputShutdown
in classSocket
-
sendUrgentData
Deprecated.unsupported- Overrides:
sendUrgentData
in classSocket
-
setKeepAlive
Deprecated.unsupported- Overrides:
setKeepAlive
in classSocket
-
setOOBInline
Deprecated.unsupported- Overrides:
setOOBInline
in classSocket
-
setReceiveBufferSize
Deprecated.unsupported- Overrides:
setReceiveBufferSize
in classSocket
-
setReuseAddress
Deprecated.unsupported- Overrides:
setReuseAddress
in classSocket
-
setSendBufferSize
Deprecated.unsupported- Overrides:
setSendBufferSize
in classSocket
-
setSoLinger
public void setSoLinger(boolean on, int linger) Does nothing as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
setSoLinger
in classSocket
-
setTcpNoDelay
Deprecated.unsupported- Overrides:
setTcpNoDelay
in classSocket
-
setTrafficClass
Deprecated.unsupported- Overrides:
setTrafficClass
in classSocket
-
shutdownInput
Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
shutdownInput
in classSocket
- Throws:
IOException
-
shutdownOutput
Flushes (as the Socket javadocs advise) and closes. Supported as of 0.9.33, prior to that threw UnsupportedOperationException- Overrides:
shutdownOutput
in classSocket
- Throws:
IOException
-