Package net.i2p.client.streaming
Interface I2PServerSocket
-
- All Known Implementing Classes:
I2PServerSocketFull
public interface I2PServerSocketStreaming server socket returned byI2PSocketManager.getServerSocket(). Defines how to listen for streaming peer connections.Note that this is not a standard Java
ServerSocket, if you need one of those, useI2PSocketManager.getStandardServerSocket()instead.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description I2PSocketaccept()Waits for the next socket connecting.voidclose()Closes the socket.AcceptingChannelgetChannel()Deprecated.I2PSocketManagergetManager()Access the manager which is coordinating the server socketlonggetSoTimeout()Get Sock Option accept timeoutvoidsetSoTimeout(long x)Set Sock Option accept timeout
-
-
-
Method Detail
-
close
void close() throws I2PExceptionCloses the socket.- Throws:
I2PException
-
accept
I2PSocket accept() throws I2PException, ConnectException, SocketTimeoutException
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() doesnt occur in some small period). Warning - unlike regular ServerSocket, may return null (through 0.9.16 only).- Returns:
- a connected I2PSocket OR NULL through 0.9.16; never null as of 0.9.17
- 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 restarting, since 0.9.34ConnectException- if the I2PServerSocket is closed, or if interrupted. Not actually thrown through 0.9.16; thrown as of 0.9.17SocketTimeoutException- if a timeout was previously set with setSoTimeout and the timeout has been reached.
-
getChannel
@Deprecated AcceptingChannel getChannel()
Deprecated.Unimplemented, unlikely to ever be implemented.- Returns:
- null always
- Since:
- 0.8.11
-
setSoTimeout
void setSoTimeout(long x)
Set Sock Option accept timeout- Parameters:
x- timeout in ms
-
getSoTimeout
long getSoTimeout()
Get Sock Option accept timeout- Returns:
- timeout in ms
-
getManager
I2PSocketManager getManager()
Access the manager which is coordinating the server socket- Returns:
- I2PSocketManager
-
-