java.lang.Object
java.net.ServerSocket
net.i2p.client.streaming.impl.StandardServerSocket
- All Implemented Interfaces:
Closeable, AutoCloseable
Bridge to I2PServerSocket.
This extends ServerSocket to make porting apps easier. accept() returns a real Socket (a StandardSocket). accept() throws IOExceptions like ServerSockets do, rather than returning null or throwing I2PExceptions.
StandardServerSockets are always bound. You may not create an unbound StandardServerSocket. Create this through the SocketManager.
Constructor Summary
ConstructorsConstructorDescriptionDoesn't really throw IOE but super() does.Method Summary
All MethodsModifier and TypeMethodDescriptionaccept()voidbind(SocketAddress endpoint) Binding is not supported.voidbind(SocketAddress endpoint, int backlog) Binding is not supported.voidclose()Channel is not supported.No remote address.intLocal port is not available.Port in returned SocketAddress will be zero.intInbound buffer size.booleanReuse address is not supported.intSocket timeout.booleanisBound()Always bound.booleanisClosed()voidsetPerformancePreferences(int connectionTime, int latency, int bandwidth) Ignored, streaming sockets manage their own tuning.voidsetReceiveBufferSize(int size) Ignored, streaming sockets manage their own tuning.voidsetReuseAddress(boolean on) Ignored, streaming sockets manage their own tuning.voidsetSoTimeout(int timeout) Socket timeout.toString()Methods inherited from class ServerSocket
getOption, implAccept, setOption, supportedOptions
Constructor Details
StandardServerSocket
StandardServerSocket(I2PServerSocketFull socket) throws IOException Doesn't really throw IOE but super() does.- Parameters:
socket- the I2P server socket that accept() and close() delegate to- Throws:
IOException- always, from the no-argument ServerSocket constructor this must call
Method Details
accept
- Overrides:
acceptin classServerSocket- Throws:
IOException
bind
Binding is not supported.- Overrides:
bindin classServerSocket- Throws:
UnsupportedOperationException- always, as an I2P server socket has no local address
bind
Binding is not supported.- Overrides:
bindin classServerSocket- Throws:
UnsupportedOperationException- always, as an I2P server socket has no local address
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classServerSocket- Throws:
IOException
getChannel
Channel is not supported.- Overrides:
getChannelin classServerSocket- Returns:
- null always, unimplemented
getInetAddress
No remote address.- Overrides:
getInetAddressin classServerSocket- Returns:
- null always
getLocalPort
public int getLocalPort()Local port is not available.- Overrides:
getLocalPortin classServerSocket- Returns:
- -1 always
getLocalSocketAddress
Port in returned SocketAddress will be zero.- Overrides:
getLocalSocketAddressin classServerSocket- Returns:
- an I2PSocketAddress as of 0.9.26; prior to that, returned null
getReceiveBufferSize
public int getReceiveBufferSize()Inbound buffer size.- Overrides:
getReceiveBufferSizein classServerSocket- Returns:
- the inbound buffer size, or 64KB if options are unavailable
getReuseAddress
public boolean getReuseAddress()Reuse address is not supported.- Overrides:
getReuseAddressin classServerSocket- Returns:
- false always
getSoTimeout
public int getSoTimeout()Socket timeout.- Overrides:
getSoTimeoutin classServerSocket- Returns:
- the socket timeout in milliseconds
isBound
isClosed
public boolean isClosed()- Overrides:
isClosedin classServerSocket
setPerformancePreferences
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) Ignored, streaming sockets manage their own tuning.setReceiveBufferSize
public void setReceiveBufferSize(int size) Ignored, streaming sockets manage their own tuning.- Overrides:
setReceiveBufferSizein classServerSocket
setReuseAddress
public void setReuseAddress(boolean on) Ignored, streaming sockets manage their own tuning.- Overrides:
setReuseAddressin classServerSocket
setSoTimeout
Socket timeout.- Overrides:
setSoTimeoutin classServerSocket- Parameters:
timeout- the timeout in milliseconds- Throws:
SocketException- if the timeout could not be set
toString
- Overrides:
toStringin classServerSocket