Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
ClientSocket Class Referenceabstract

#include <elm/net/ClientSocket.h>

Public Member Functions

virtual ~ClientSocket (void)
 
virtual int port (void) const =0
 
virtual const stringhost (void) const =0
 
virtual const stringservice (void) const =0
 
virtual void connect (void)=0
 
virtual void disconnect (void)=0
 
virtual io::InStreamin (void)=0
 
virtual io::OutStreamout (void)=0
 

Static Public Member Functions

static ClientSocketmake (const string &host, int port)
 
static ClientSocketmake (const string &host, const string &service)
 
static ClientSocketmake (int port)
 

Detailed Description

Class implementing a client through a socket connection.

Constructor & Destructor Documentation

◆ ~ClientSocket()

virtual ~ClientSocket ( void  )
inlinevirtual

Member Function Documentation

◆ connect()

void connect ( void  )
pure virtual

Connect the client to the server.

Exceptions
ExceptionIf there is an error.

◆ disconnect()

void disconnect ( void  )
pure virtual

Disconnect from the server.

Exceptions
ExceptionIf there is an error.

◆ host()

const string & host ( void  ) const
pure virtual

Get the host name of the server the client has to connect to.

Returns
Server host name.

Referenced by ClientSocket::make().

◆ in()

io::InStream & in ( void  )
pure virtual

Obtain the input channel for the connection.

Returns
Input channel.
Exceptions
ExceptionIf there is an error.

◆ make() [1/3]

ClientSocket * make ( const string host,
const string service 
)
static

Build a client socket connecting to the given host with the given service.

Parameters
hostHost to connect to (numeric or symbolic form).
serviceService to connect to.

References ClientSocket::host(), and ClientSocket::service().

◆ make() [2/3]

ClientSocket * make ( const string host,
int  port 
)
static

Build a client socket connecting to the given host on the given port.

Parameters
hostHost to connect to (numeric or symbolic form).
portPort to connect to.

References ClientSocket::host(), and ClientSocket::port().

◆ make() [3/3]

ClientSocket * make ( int  port)
static

Build a client socket connecting to the local host on the given port.

Parameters
portPort to connect to.

References ClientSocket::port().

◆ out()

io::OutStream & out ( void  )
pure virtual

Obtain the output channel for the connection.

Returns
Output channel.
Exceptions
ExceptionIf there is an error.

◆ port()

int port ( void  ) const
pure virtual

Get the port of the client.

Returns
Connection port.

Referenced by ClientSocket::make().

◆ service()

const string & service ( void  ) const
pure virtual

If any, get the name of the service of connection.

Returns
Connected service name.

Referenced by ClientSocket::make().


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