Client.Client Class Reference


Detailed Description

Client is a base class representing a client connection to the server.

It is used for connecting to a given host and port, and when the start() method is called on the thread, it continiously reads packets from the server and calls processPacket() method. It is up to the subclasses to this class to override this method and do something meaningful with the packet.

kConnectionTimeout - set initially to detect faulty connections (to. servers which are not recognized by us). Especially important if we need to get some kind of a confirmation message. kDefaultTimeout - set after a successful connection. Setting to None, ensures that the client never timeouts on reading the data from the server.

#include <class_client_1_1_client.h>

Inheritance diagram for Client.Client:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  __init__ ()
  setTimeout ()
  connectTo ()
  Connect to a given host through a given port.
  disconnect ()
  Disconnect the client from the server by closing the socket.
  isConnected ()
  Returns True if the client is connected to the server.
  run ()
  Once the thread is started, this run method is called, which continually reads packets from the network and process it.
  processPacket ()
  Subclasses will override this method to perform specific operation on the packet.

Public Attributes

float  kConnectionTimeout = 10.0
  kDefaultTimeout = None

Member Function Documentation

Client.Client.__init__ ( )
Client.Client.setTimeout ( )
Client.Client.connectTo ( )

Connect to a given host through a given port.

Returns true if the connection succeded.

Reimplemented in MessageClient.MessageClient.

Client.Client.disconnect ( )

Disconnect the client from the server by closing the socket.

Reimplemented in MessageClient.MessageClient.

Client.Client.isConnected ( )

Returns True if the client is connected to the server.

Client.Client.run ( )

Once the thread is started, this run method is called, which continually reads packets from the network and process it.

Client.Client.processPacket ( )

Subclasses will override this method to perform specific operation on the packet.

Reimplemented in MessageClient.MessageClient.


Member Data Documentation


Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client
Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client Client.Client