- All Known Implementing Classes:
AbstractIpSocket
,IpSocketModem
public interface IpSocket
Network socket binding that handles asynchronous I/O operations for a
non-blocking NIO network channel.
An IpSocket
interfaces with the underlying asynchronous networking
system via an IpSocketContext
. The socket context invokes I/O
callbacks on the IpSocket
when the underlying network socket is
ready to perform I/O operations permitted by the socket context's FlowControl
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Lifecycle callback invoked by the socket context after it hasbecome
a newsocket
implementation.void
Lifecycle callback invoked by the socket context after the underlying network socket has opened a connection.void
Lifecycle callback invoked by the socket context after the underlying network connection has disconnected.void
Lifecycle callback invoked by the socket context when the underlying network socket fails by throwing anerror
.void
Lifecycle callback invoked by the socket context after the underlying network socket has established a secure connection.void
Lifecycle callback invoked by the socket context after the underlying network connection has timed out.void
didWrite()
I/O callback invoked by the socket context after the underlying network socket has completed writing all data in itsoutputBuffer
.void
doRead()
I/O callback invoked by the socket context asking thisIpSocket
to read input data out of the socket context'sinputBuffer
.void
doWrite()
I/O callback invoked by the socket context asking thisIpSocket
to write output data into the socket context'soutputBuffer
.long
Returns the number of idle milliseconds after which thisIpSocket
should be closed due to inactivity.Returns the network socket context to which thisIpSocket
is bound; returnsnull
if thisIpSocket
is unbound.void
setIpSocketContext
(IpSocketContext context) Sets the network socket context to which thisIpSocket
is bound.void
willBecome
(IpSocket socket) Lifecycle callback invoked by the socket context before it hasbecome
a newsocket
implementation.void
Lifecycle callback invoked by the socket context before the underlying network socket attempts to open a connection.void
Lifecycle callback invoked by the socket context before the underlying network socket establishes a secure connection.
-
Method Details
-
ipSocketContext
IpSocketContext ipSocketContext()Returns the network socket context to which thisIpSocket
is bound; returnsnull
if thisIpSocket
is unbound. -
setIpSocketContext
Sets the network socket context to which thisIpSocket
is bound. -
idleTimeout
long idleTimeout()Returns the number of idle milliseconds after which thisIpSocket
should be closed due to inactivity. Returns-1
if a default idle timeout should be used. Returns0
if the underlying network socket should not time out. -
doRead
void doRead()I/O callback invoked by the socket context asking thisIpSocket
to read input data out of the socket context'sinputBuffer
. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoRead
calls. -
doWrite
void doWrite()I/O callback invoked by the socket context asking thisIpSocket
to write output data into the socket context'soutputBuffer
. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWrite
ordidWrite
calls. -
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 otherdoWrite
ordidWrite
calls. -
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
Lifecycle callback invoked by the socket context before it hasbecome
a newsocket
implementation. -
didBecome
Lifecycle callback invoked by the socket context after it hasbecome
a newsocket
implementation. -
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
Lifecycle callback invoked by the socket context when the underlying network socket fails by throwing anerror
. The socket will automatically be closed.
-