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
class StandardSocket extends Socket
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
Constructors Constructor Description StandardSocket(I2PSocket socket)
-
Method Summary
-
Methods inherited from class java.net.Socket
getOption, setOption, setSocketImplFactory, supportedOptions
-
-
-
-
Constructor Detail
-
StandardSocket
StandardSocket(I2PSocket socket)
-
-
Method Detail
-
bind
public void bind(SocketAddress bindpoint)
- Overrides:
bind
in classSocket
- Throws:
UnsupportedOperationException
- always
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classSocket
- Throws:
IOException
-
connect
public void connect(SocketAddress endpoint)
- Overrides:
connect
in classSocket
- Throws:
UnsupportedOperationException
- always
-
connect
public void connect(SocketAddress endpoint, int timeout)
- Overrides:
connect
in classSocket
- Throws:
UnsupportedOperationException
- always
-
getChannel
public SocketChannel getChannel()
- Overrides:
getChannel
in classSocket
- Returns:
- null always, unimplemented
-
getInetAddress
public InetAddress getInetAddress()
- Overrides:
getInetAddress
in classSocket
- Returns:
- null always
-
getInputStream
public InputStream getInputStream() throws IOException
- Overrides:
getInputStream
in classSocket
- Throws:
IOException
-
getKeepAlive
public boolean getKeepAlive()
- Overrides:
getKeepAlive
in classSocket
-
getLocalAddress
public InetAddress getLocalAddress()
- Overrides:
getLocalAddress
in classSocket
- Returns:
- null always
-
getLocalPort
public int getLocalPort()
- Overrides:
getLocalPort
in classSocket
- Returns:
- the port or 0 if unknown
-
getLocalSocketAddress
public SocketAddress 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
public OutputStream getOutputStream() throws IOException
- Overrides:
getOutputStream
in classSocket
- Throws:
IOException
-
getReceiveBufferSize
public int getReceiveBufferSize()
- Overrides:
getReceiveBufferSize
in classSocket
-
getRemoteSocketAddress
public SocketAddress 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
-
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
public void setSoTimeout(int timeout) throws SocketException
- 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
public void shutdownInput() throws IOException
- Overrides:
shutdownInput
in classSocket
- Throws:
IOException
-
shutdownOutput
public void shutdownOutput() throws IOException
- Overrides:
shutdownOutput
in classSocket
- Throws:
IOException
-
-