SockIt
Public Member Functions

Client Class Reference

#include <Client.h>

Inheritance diagram for Client:
NetworkObject TcpClient UdpClient

List of all members.

Public Member Functions

 Client ()
virtual ~Client ()
virtual void send (const string &data)=0
virtual void send_bytes (const vector< byte > &bytes)=0
virtual string get_host ()=0
virtual int get_port ()=0
 FB_JSAPI_EVENT (resolve, 0,())

Detailed Description

An abstract interface for a client object. This registers the generic client-specific events to javascript, and registers the 'send' method to the javascript API.

Definition at line 17 of file Client.h.


Constructor & Destructor Documentation

Client::Client ( )

Constructs a default client object by registering the 'send' method for this client to the javascript.

Definition at line 10 of file Client.cpp.

References get_host(), get_port(), send(), and send_bytes().

{
    registerMethod("send", make_method(this, &Client::send));
    registerMethod("sendBytes", make_method(this, &Client::send_bytes));
    registerMethod("getHost", make_method(this, &Client::get_host));
    registerMethod("getPort", make_method(this, &Client::get_port));
}
virtual Client::~Client ( ) [inline, virtual]

Deconstructs a client object

Definition at line 29 of file Client.h.

{}

Member Function Documentation

Client::FB_JSAPI_EVENT ( resolve  ,
,
()   
)

A javascript event to be fired when the client has successfully resolved the remote host name and is prepared to send data to the remote host.

virtual string Client::get_host ( ) [pure virtual]

Get host to which this client connects

Returns:
The host to which this client connects

Implemented in TcpClient, and UdpClient.

Referenced by Client().

virtual int Client::get_port ( ) [pure virtual]

Get the port on the remote host to this client connects

Returns:
The port on the remote host to which this client connects

Implemented in TcpClient, and UdpClient.

Referenced by Client().

virtual void Client::send ( const string &  data) [pure virtual]

Asynchronously sends data to the remote host to which this client is connected.

Parameters:
dataThe data to send across the wire

Implemented in TcpClient, and UdpClient.

Referenced by Client().

virtual void Client::send_bytes ( const vector< byte > &  bytes) [pure virtual]

Asynchronously sends bytes to the remote host to which this client is connected.

Parameters:
bytesThe bytes of data to send across the wire

Implemented in TcpClient, and UdpClient.

Referenced by Client().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends Defines