SocketClient

Wrapper for a tcp socket client.

Constructors

this
this(SocketServer!T server, TCPConnection connection)

Creates a new tcp client.

Members

Functions

close
void close()

Closes the socket.

fireEvent
void fireEvent(SocketEventType eventType, SocketEventArgs!T e)

Fires a socket event.

moveNext
void moveNext(SocketEventType eventType)

Moves onto the next event handler in a chain.

process
void process()

Processes the client.

read
void read()

Reads the current available bytes.

read
void read(size_t amount)

Reads a specific amount of bytes. Paramms: amount = The amount of bytes to read.

report
void report(Exception error)

Reports an error to the error handler.

resetReceive
void resetReceive(size_t cachedAmount = 0)

Resets the current receive state.

setupEvents
void setupEvents(SocketEventChain!T connectEvents, SocketEventChain!T disconnectEvents, SocketEventChain!T receiveEvents, SocketEventChain!T errorEvents)

Sets up events for the client.

write
void write(ubyte[] buffer)

Writes a buffer to the socket.

Properties

address
auto address [@property getter]

Gets the address string.

availableReceiveAmount
size_t availableReceiveAmount [@property getter]

Gets the amount of available bytes for receive.

buffer
auto buffer [@property getter]

Gets the current buffer.

clientId
size_t clientId [@property setter]

Sets the client id.

clientId
size_t clientId [@property getter]

Gets the client id.

connected
bool connected [@property getter]

Gets a boolean determining whether the client is connected or not.

currentReceiveAmount
size_t currentReceiveAmount [@property getter]

Gets the current received amount of bytes.

data
T data [@property getter]

Gets the generic data associated with the client.

data
T data [@property setter]

Sets the generic data associated with the client.

disconnected
bool disconnected [@property getter]

Gets a boolean determining whether the client has been disconnected or not.

eventArgs
auto eventArgs [@property getter]

Gets the event args of the client.

ipAddress
auto ipAddress [@property getter]

Gets the remote ip address.

port
auto port [@property getter]

Gets the remote port.

remoteAddress
auto remoteAddress [@property getter]

Gets the remote address.

Meta