java.lang.Object
net.i2p.client.streaming.impl.I2PServerSocketFull
- All Implemented Interfaces:
I2PServerSocket
Bridge to allow accepting new connections.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PSocketManagerFullThe manager that opened this listening socket.Constructor Summary
ConstructorsConstructorDescriptionBridge to accept connections from the given manager.Method Summary
All MethodsModifier and TypeMethodDescriptionaccept()Waits for the next socket connecting.voidclose()Close the connection.Socket manager that owns this server socket.longCurrent accept timeout.voidsetSoTimeout(long x) Accept timeout in milliseconds.
Field Details
_socketManager
The manager that opened this listening socket.
Constructor Details
I2PServerSocketFull
Bridge to accept connections from the given manager.- Parameters:
mgr- the socket manager to accept connections from
Method Details
accept
Waits for the next socket connecting. If a remote user tried to make a connection and the local application wasn't .accept()ing new connections, they should get refused (if .accept() doesn't occur in some small period). Unlike a regular ServerSocket, a connection left unaccepted is answered with a streaming RESET and accept() reports the failure by throwing instead of returning null.- Specified by:
acceptin interfaceI2PServerSocket- Returns:
- a connected I2PSocket, never null
- Throws:
I2PException- if there is a problem with reading a new socket from the data available (e.g. the I2PSession is closed)RouterRestartException- (extends I2PException) if the router is apparently restartingConnectException- if the I2PServerSocket is closed, or if interrupted.SocketTimeoutException- if a timeout was previously set with setSoTimeout and the timeout has been reached.
getSoTimeout
public long getSoTimeout()Current accept timeout.- Specified by:
getSoTimeoutin interfaceI2PServerSocket- Returns:
- the current timeout in milliseconds
setSoTimeout
public void setSoTimeout(long x) Accept timeout in milliseconds.- Specified by:
setSoTimeoutin interfaceI2PServerSocket- Parameters:
x- timeout in milliseconds
close
getManager
Socket manager that owns this server socket.- Specified by:
getManagerin interfaceI2PServerSocket- Returns:
- the socket manager