Easy Simple Network Library  0.3.7
All Classes Functions Modules
Public Member Functions | List of all members
esnlib::Client Class Referenceabstract

Client class (interface) More...

#include <Client.h>

Public Member Functions

virtual bool Connect (const std::string &svraddr, int svrport)=0
 
virtual void Disconnect ()=0
 Disconnect the server.
 
virtual bool Connected ()=0
 
virtual bool IsConnecting ()=0
 
virtual void Write (IoBufferPtr data)=0
 
virtual void Write (void *data)=0
 
virtual void SetConnectTimeOut (int seconds)=0
 
virtual void SetIdleTime (int idletype, int idletime)=0
 
virtual void SetIoHandler (IoHandlerPtr handler)=0
 
virtual void SetIoFilter (IoFilterPtr filter)=0
 
virtual void SetIoBufferManager (IoBufferManagerPtr manager)=0
 
virtual void SetIoServiceManager (IoServiceManagerPtr manager)=0
 
virtual IoBufferPtr GetFreeBuffer (int bufsize)=0
 
virtual std::string GetDefaultLocalIp ()=0
 
virtual std::string GetLocalIp ()=0
 
virtual int GetLocalPort ()=0
 
virtual std::string GetRemoteIp ()=0
 
virtual int GetRemotePort ()=0
 
virtual SessionPtr GetCurrentSession ()=0
 
virtual int GetId ()=0
 
virtual void SetId (int id)=0
 
virtual bool HasGlobalData ()=0
 
virtual CommonDataPtr GetGlobalData ()=0
 
virtual bool EnableSsl (bool needverify=true, const std::string &verifyfile=std::string(), const std::string &certfile=std::string(), const std::string &keyfile=std::string())=0
 
virtual bool HasSsl ()=0
 

Detailed Description

Client class (interface)

Member Function Documentation

virtual bool esnlib::Client::Connect ( const std::string &  svraddr,
int  svrport 
)
pure virtual

Connect the server

Parameters
svraddrThe IP of the server
svrportThe port of the server
Returns
Return true if connect successfully
virtual bool esnlib::Client::Connected ( )
pure virtual

Check whether the client has connected to the server

Returns
Return true if the client has connected to the server
virtual bool esnlib::Client::EnableSsl ( bool  needverify = true,
const std::string &  verifyfile = std::string(),
const std::string &  certfile = std::string(),
const std::string &  keyfile = std::string() 
)
pure virtual

Try to enable SSL(Secure Sockets Layer)

Parameters
needverifyWhether need to verity the certificate
verifyfileThe verify file
certfileThe Cert. file
keyfileThe private key file
Returns
Return true if set up SSL successfully
virtual SessionPtr esnlib::Client::GetCurrentSession ( )
pure virtual

Get current session

Returns
The pointer of current session
virtual std::string esnlib::Client::GetDefaultLocalIp ( )
pure virtual

Get the local default IP of the client

Returns
The default IP of the client
virtual IoBufferPtr esnlib::Client::GetFreeBuffer ( int  bufsize)
pure virtual

Get a free buffer from the Buffer Manager

Parameters
bufsizeThe size of the free buffer
Returns
The pointer of the free buffer (IO buffer)
virtual CommonDataPtr esnlib::Client::GetGlobalData ( )
pure virtual

Get the global data of the client

Returns
The pointer of the global data
virtual int esnlib::Client::GetId ( )
pure virtual

Get the client's ID

Returns
The client ID
virtual std::string esnlib::Client::GetLocalIp ( )
pure virtual

Get the local IP of the client

Returns
The IP of the client
virtual int esnlib::Client::GetLocalPort ( )
pure virtual

Get the local port

Returns
The port of the client
virtual std::string esnlib::Client::GetRemoteIp ( )
pure virtual

Get the remote server's IP

Returns
The IP of the server
virtual int esnlib::Client::GetRemotePort ( )
pure virtual

Get the remote server's port

Returns
The port of the server
virtual bool esnlib::Client::HasGlobalData ( )
pure virtual

Check whether the client has global data attached

Returns
Return true if the client has global data
virtual bool esnlib::Client::HasSsl ( )
pure virtual

Check whether the client has SSL(Secure Sockets Layer)

Returns
Return true if the client has SSL
virtual bool esnlib::Client::IsConnecting ( )
pure virtual

Check whether the client is connecting to the server

Returns
Return true if the client is connecting to the server
virtual void esnlib::Client::SetConnectTimeOut ( int  seconds)
pure virtual

Set connect timeout value

Parameters
secondsThe value of timeout time (in second)
virtual void esnlib::Client::SetId ( int  id)
pure virtual

Set the client's ID

Parameters
idThe client ID
virtual void esnlib::Client::SetIdleTime ( int  idletype,
int  idletime 
)
pure virtual

Set idle time

Parameters
idletypeThe idle type (1 for read idle, 2 for write idle, 0 for both)
idletimeThe idle time (in second)
virtual void esnlib::Client::SetIoBufferManager ( IoBufferManagerPtr  manager)
pure virtual

Set Buffer Manager (memory pool)

Parameters
managerThe pointer of the buffer manager
virtual void esnlib::Client::SetIoFilter ( IoFilterPtr  filter)
pure virtual

Set IO Filter

Parameters
filterThe pointer of the filter
virtual void esnlib::Client::SetIoHandler ( IoHandlerPtr  handler)
pure virtual

Set IO Handler

Parameters
handlerThe pointer of the handler
virtual void esnlib::Client::SetIoServiceManager ( IoServiceManagerPtr  manager)
pure virtual

Set IO Thread Manager (IO thread pool)

Parameters
managerThe pointer of the IO service manager
virtual void esnlib::Client::Write ( IoBufferPtr  data)
pure virtual

Write data to server

Parameters
dataThe data (a buffer pointer)
virtual void esnlib::Client::Write ( void *  data)
pure virtual

Write data to server

Parameters
dataThe data (a common pointer)

The documentation for this class was generated from the following file: