AsyncTCPConnection

Wraps a TCP stream between 2 network adapters, using a custom handler to signal related events. Many of these objects can be active concurrently in a thread if the event loop is running and the handlers do not block.

Constructors

this
this(EventLoop evl, fd_t preInitializedSocket)

Members

Functions

host
typeof(this) host(string hostname, size_t port)

(Blocking) Resolves the specified host and resets the peer to this address. Use AsyncDNS for a non-blocking resolver. (only usable before connecting).

ip
typeof(this) ip(string ip, size_t port)

Sets the peer to the specified IP address and port. (only usable before connecting).

kill
bool kill(bool forced)

Removes the connection from the event loop, closing it if necessary, and cleans up the underlying resources.

recv
uint recv(ubyte[] ub)

Receive data from the underlying stream. To be used when TCPEvent.READ is received by the callback handler. IMPORTANT: This must be called until is returns a lower value than the buffer!

run
bool run(void delegate(TCPEvent) del)

Starts the connection by registering the associated callback handler in the underlying OS event loop.

run
bool run(TCPEventHandler del)
send
uint send(ubyte[] ub)

Send data through the underlying stream by moving it into the OS buffer.

setOption
bool setOption(TCPOption op, T val)

Changes the default OS configurations for this underlying TCP Socket.

Mixins

__anonymous
mixin DefStatus
Undocumented in source.
__anonymous
mixin COSocketMixins
Undocumented in source.

Properties

inbound
bool inbound [@property getter]

Returns true if this connection was accepted by an AsyncTCPListener instance.

inbound
bool inbound [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
isConnected
bool isConnected [@property getter]

Returns false if the connection has gone.

local
NetworkAddress local [@property getter]

Returns the OS-specific structure of the internet address for the local end of the connection.

noDelay
bool noDelay [@property setter]

Disables(true)/enables(false) nagle's algorithm (default:enabled).

noDelay
bool noDelay [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
peer
NetworkAddress peer [@property getter]

Returns the OS-specific structure of the internet address of the remote network adapter

peer
NetworkAddress peer [@property setter]

Sets the remote address as an OS-specific structure (only usable before connecting).

preInitializedSocket
fd_t preInitializedSocket [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
socket
fd_t socket [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
socket
fd_t socket [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

m_evLoop
EventLoop m_evLoop;
Undocumented in source.

Mixed In Members

From mixin DefStatus

hasError
bool hasError [@property getter]

Check this property to make sure the event loop hasn't failed

status
StatusInfo status [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
error
string error [@property getter]

Returns a human-readable error message from the underlying operating system.

From mixin COSocketMixins

CleanupData
struct CleanupData
Undocumented in source.
disconnecting
bool disconnecting [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
disconnecting
bool disconnecting [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
connected
bool connected [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
connected
bool connected [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
writeBlocked
bool writeBlocked [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
writeBlocked
bool writeBlocked [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
readBlocked
bool readBlocked [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
readBlocked
bool readBlocked [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
evInfo
EventInfo* evInfo [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
evInfo
EventInfo* evInfo [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Meta