-
- All Known Implementing Classes:
AbstractSocket,SocketModem
public interface SocketNetwork socket binding that handles asynchronous I/O operations for a non-blocking NIO network channel. ASocketinterfaces with the underlying asynchronous networking system via aSocketContext. The socket context invokes I/O callbacks on theSocketwhen the underlying network socket is ready to perform I/O operations permitted by the socket context'sFlowControl.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddidBecome(Socket socket)Lifecycle callback invoked by the socket context after it hasbecomea newsocketimplementation.voiddidConnect()Lifecycle callback invoked by the socket context after the underlying network socket has opened a connection.voiddidDisconnect()Lifecycle callback invoked by the socket context after the underlying network connection has disconnected.voiddidFail(Throwable error)Lifecycle callback invoked by the socket context when the underlying network socket fails by throwing anerror.voiddidSecure()Lifecycle callback invoked by the socket context after the underlying network socket has established a secure connection.voiddidTimeout()Lifecycle callback invoked by the socket context after the underlying network connection has timed out.voiddidWrite()I/O callback invoked by the socket context after the underlying network socket has completed writing all data in itsoutputBuffer.voiddoRead()I/O callback invoked by the socket context asking thisSocketto read input data out of the socket context'sinputBuffer.voiddoWrite()I/O callback invoked by the socket context asking thisSocketto write output data into the socket context'soutputBuffer.longidleTimeout()Returns the number of idle milliseconds after which thisSocketshould be closed due to inactivity.voidsetSocketContext(SocketContext context)Sets the network socket context to which thisSocketis bound.SocketContextsocketContext()Returns the network socket context to which thisSocketis bound; returnsnullif thisSocketis unbound.voidwillBecome(Socket socket)Lifecycle callback invoked by the socket context before it hasbecomea newsocketimplementation.voidwillConnect()Lifecycle callback invoked by the socket context before the underlying network socket attempts to open a connection.voidwillSecure()Lifecycle callback invoked by the socket context before the underlying network socket establishes a secure connection.
-
-
-
Method Detail
-
socketContext
SocketContext socketContext()
Returns the network socket context to which thisSocketis bound; returnsnullif thisSocketis unbound.
-
setSocketContext
void setSocketContext(SocketContext context)
Sets the network socket context to which thisSocketis bound.
-
idleTimeout
long idleTimeout()
Returns the number of idle milliseconds after which thisSocketshould be closed due to inactivity. Returns-1if a default idle timeout should be used. Returns0if the underlying network socket should not time out.
-
doRead
void doRead()
I/O callback invoked by the socket context asking thisSocketto read input data out of the socket context'sinputBuffer. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoReadcalls.
-
doWrite
void doWrite()
I/O callback invoked by the socket context asking thisSocketto write output data into the socket context'soutputBuffer. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls.
-
didWrite
void didWrite()
I/O callback invoked by the socket context after the underlying network socket has completed writing all data in itsoutputBuffer. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls.
-
willConnect
void willConnect()
Lifecycle callback invoked by the socket context before the underlying network socket attempts to open a connection.
-
didConnect
void didConnect()
Lifecycle callback invoked by the socket context after the underlying network socket has opened a connection.
-
willSecure
void willSecure()
Lifecycle callback invoked by the socket context before the underlying network socket establishes a secure connection.
-
didSecure
void didSecure()
Lifecycle callback invoked by the socket context after the underlying network socket has established a secure connection.
-
willBecome
void willBecome(Socket socket)
Lifecycle callback invoked by the socket context before it hasbecomea newsocketimplementation.
-
didBecome
void didBecome(Socket socket)
Lifecycle callback invoked by the socket context after it hasbecomea newsocketimplementation.
-
didTimeout
void didTimeout()
Lifecycle callback invoked by the socket context after the underlying network connection has timed out. The socket will automatically be closed.
-
didDisconnect
void didDisconnect()
Lifecycle callback invoked by the socket context after the underlying network connection has disconnected.
-
didFail
void didFail(Throwable error)
Lifecycle callback invoked by the socket context when the underlying network socket fails by throwing anerror. The socket will automatically be closed.
-
-