Package net.i2p.client.streaming.impl
Class StandardSocket
java.lang.Object
java.net.Socket
net.i2p.client.streaming.impl.StandardSocket
- All Implemented Interfaces:
Closeable
,AutoCloseable
Bridge to I2PSocket.
This extends Socket to make porting apps easier.
Methods throw IOExceptions like Sockets do, rather than returning
null for some methods.
StandardSockets are always bound, and always start out connected
(unless connectDelay is > 0).
You may not create an unbound StandardSocket.
Create this through the SocketManager.
Todo: Make public and add getPeerDestination() ?
- Since:
- 0.8.4
- Author:
- zzz
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(SocketAddress bindpoint) void
close()
void
connect
(SocketAddress endpoint) void
connect
(SocketAddress endpoint, int timeout) boolean
int
boolean
int
getPort()
int
boolean
int
int
int
boolean
int
boolean
isBound()
boolean
isClosed()
boolean
boolean
boolean
void
sendUrgentData
(int data) void
setKeepAlive
(boolean on) void
setOOBInline
(boolean on) void
setPerformancePreferences
(int connectionTime, int latency, int bandwidth) Does nothing.void
setReceiveBufferSize
(int size) Does nothing.void
setReuseAddress
(boolean on) Does nothing.void
setSendBufferSize
(int size) Does nothing.void
setSoLinger
(boolean on, int linger) Does nothing.void
setSoTimeout
(int timeout) void
setTcpNoDelay
(boolean on) Does nothing.void
setTrafficClass
(int tc) Does nothing.void
void
toString()
Methods inherited from class java.net.Socket
getOption, setOption, setSocketImplFactory, supportedOptions
-
Constructor Details
-
StandardSocket
StandardSocket(I2PSocket socket)
-
-
Method Details
-
bind
- Overrides:
bind
in classSocket
- Throws:
UnsupportedOperationException
- always
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classSocket
- Throws:
IOException
-
connect
- Overrides:
connect
in classSocket
- Throws:
UnsupportedOperationException
- always
-
connect
- Overrides:
connect
in classSocket
- Throws:
UnsupportedOperationException
- always
-
getChannel
- Overrides:
getChannel
in classSocket
- Returns:
- null always, unimplemented
-
getInetAddress
- Overrides:
getInetAddress
in classSocket
- Returns:
- null always
-
getInputStream
- Overrides:
getInputStream
in classSocket
- Throws:
IOException
-
getKeepAlive
public boolean getKeepAlive()- Overrides:
getKeepAlive
in classSocket
-
getLocalAddress
- Overrides:
getLocalAddress
in classSocket
- Returns:
- null always
-
getLocalPort
public int getLocalPort()- Overrides:
getLocalPort
in classSocket
- Returns:
- the port or 0 if unknown
-
getLocalSocketAddress
- Overrides:
getLocalSocketAddress
in classSocket
- Returns:
- an I2PSocketAddress as of 0.9.26; prior to that, returned null
- Since:
- implemented in 0.9.26
-
getOOBInline
public boolean getOOBInline()- Overrides:
getOOBInline
in classSocket
- Returns:
- false always
-
getOutputStream
- Overrides:
getOutputStream
in classSocket
- Throws:
IOException
-
getPort
public int getPort() -
getReceiveBufferSize
public int getReceiveBufferSize()- Overrides:
getReceiveBufferSize
in classSocket
-
getRemoteSocketAddress
- Overrides:
getRemoteSocketAddress
in classSocket
- Returns:
- an I2PSocketAddress as of 0.9.26; prior to that, threw UnsupportedOperationException
- Since:
- implemented in 0.9.26
-
getReuseAddress
public boolean getReuseAddress()- Overrides:
getReuseAddress
in classSocket
- Returns:
- false always
-
getSendBufferSize
public int getSendBufferSize()- Overrides:
getSendBufferSize
in classSocket
-
getSoLinger
public int getSoLinger()- Overrides:
getSoLinger
in classSocket
-
getSoTimeout
public int getSoTimeout()- Overrides:
getSoTimeout
in classSocket
-
getTcpNoDelay
public boolean getTcpNoDelay()- Overrides:
getTcpNoDelay
in classSocket
- Returns:
- false always
-
getTrafficClass
public int getTrafficClass()- Overrides:
getTrafficClass
in classSocket
- Returns:
- 0 always
-
isBound
public boolean isBound() -
isClosed
public boolean isClosed() -
isConnected
public boolean isConnected()- Overrides:
isConnected
in classSocket
-
isInputShutdown
public boolean isInputShutdown()- Overrides:
isInputShutdown
in classSocket
-
isOutputShutdown
public boolean isOutputShutdown()- Overrides:
isOutputShutdown
in classSocket
-
sendUrgentData
public void sendUrgentData(int data) - Overrides:
sendUrgentData
in classSocket
- Throws:
UnsupportedOperationException
- always
-
setKeepAlive
public void setKeepAlive(boolean on) - Overrides:
setKeepAlive
in classSocket
-
setOOBInline
public void setOOBInline(boolean on) - Overrides:
setOOBInline
in classSocket
- Throws:
UnsupportedOperationException
- if on is true
-
setPerformancePreferences
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) Does nothing.- Overrides:
setPerformancePreferences
in classSocket
-
setReceiveBufferSize
public void setReceiveBufferSize(int size) Does nothing.- Overrides:
setReceiveBufferSize
in classSocket
-
setReuseAddress
public void setReuseAddress(boolean on) Does nothing.- Overrides:
setReuseAddress
in classSocket
-
setSendBufferSize
public void setSendBufferSize(int size) Does nothing.- Overrides:
setSendBufferSize
in classSocket
-
setSoLinger
public void setSoLinger(boolean on, int linger) Does nothing.- Overrides:
setSoLinger
in classSocket
-
setSoTimeout
- Overrides:
setSoTimeout
in classSocket
- Throws:
SocketException
-
setTcpNoDelay
public void setTcpNoDelay(boolean on) Does nothing.- Overrides:
setTcpNoDelay
in classSocket
-
setTrafficClass
public void setTrafficClass(int tc) Does nothing.- Overrides:
setTrafficClass
in classSocket
-
shutdownInput
- Overrides:
shutdownInput
in classSocket
- Throws:
IOException
-
shutdownOutput
- Overrides:
shutdownOutput
in classSocket
- Throws:
IOException
-
toString
-