deferred class interface ES_NON_BLOCKING_CONNECTOR
--
-- A utility class to allow another class to make multiplexed non-
-- blocking connects.
--
feature(s) from ES_NON_BLOCKING_CONNECTOR
-- Utilities
connect_socket (socket: ES_STREAM_SOCKET; address: STRING; port: INTEGER; payload: ANY)
-- Attempt to connect socket to address and port.
require
good_socket: socket /= Void and then socket.open and not socket.connected;
non_blocking_socket: socket.non_blocking;
address_not_void: address /= Void;
good_port: port >= 1 and port < 65535
ensure
pending_or_not: socket.connected or not socket.connected
connect_socket_with_timeout (socket: ES_STREAM_SOCKET; address: STRING; port: INTEGER; seconds: INTEGER; payload: ANY)
-- Attempt a non-blocking connect that will timeout after seconds.
require
good_socket: socket /= Void and then socket.open and not socket.connected;
non_blocking_socket: socket.non_blocking;
address_not_void: address /= Void;
good_port: port >= 1 and port < 65535;
sensible_timeout: seconds >= 1 and seconds <= 1000000
ensure
pending_or_not: socket.connected or not socket.connected
feature(s) from ES_NON_BLOCKING_CONNECTOR
-- Callback
connect_complete (socket: ES_STREAM_SOCKET; payload: ANY)
-- Called when a connection is complete
require
not_void: socket /= Void;
connected: socket.connected
connect_error (socket: ES_STREAM_SOCKET; payload: ANY)
-- Called if a connect attempt had an error.
require
not_void: socket /= Void;
has_error: socket.error
connect_timed_out (socket: ES_STREAM_SOCKET; payload: ANY)
-- Called if the session had a timeout that triggered.
require
not_void: socket /= Void
end of deferred ES_NON_BLOCKING_CONNECTOR