class ppsocket

A class for dealing with sockets. More...

Definition#include <ppsocket.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

A class for dealing with sockets.

 ppsocket ()

Constructs a ppsocket

 ppsocket (const ppsocket&)

Copy constructor

ppsocket ()

[virtual]

Destructor

bool  connect (const char * const Peer, int PeerPort, const char * const Host = NULL, int HostPort = 0)

[virtual]

Connects to a given host.

Parameters:

Returns: true on success, false otherwise.

bool  reconnect ()

[virtual]

Reopens the connection after closing it.

Returns: true on success, false otherwise.

string  toString ()

[virtual]

Retrieve a string representation of the ppsocket.

Returns: a string in the form "<host>:<hostport> -> <peer>:<peerport>" where elements not known, are replaced by "???" and none-existing elements are represented by the word "none".

bool  listen (const char * const Host, int Port)

[virtual]

Starts listening.

Parameters:

Returns: true on success, false otherwise.

ppsocketaccept (string *Peer)

Accept a connection.

Parameters:

Returns: A pointer to a new instance for the accepted connection or NULL if an error happened.

bool  dataToGet (int sec, int usec)

[const]

Check and optionally wait for incoming data.

Parameters:

Returns: true if data is available, false otherwise.

int  getBufferStore (bufferStore &a, bool wait = true)

Receive data into a bufferStore .

Parameters:

Returns: 1 if a bufferStore received, 0, if no bufferStore received, -1 on error.

bool  sendBufferStore (const bufferStore &a)

Sends data from a bufferStore .

Parameters:

Returns: true on success, false otherwise.

bool  closeSocket (void)

Closes the connection.

Returns: true on success, false otherwise.

bool  bindSocket (const char * const Host, int Port)

Binds to a local address and port.

Parameters:

Returns: true on success, false otherwise.

bool  bindInRange (const char * const Host, int Low, int High, int Retries)

Tries repeated binds to a local address and port. If Retries is <= High - Low, then the port to bind is randomly chosen in the given range. Otherwise, all ports starting from High up to Low are tried in sequence.

Parameters:

Returns: true on success, false otherwise.

bool  linger (bool LingerOn, int LingerTime = 0)

Sets the linger parameter of the socket.

Parameters:

Returns: true on success, false otherwise.

bool  getPeer (string *Peer, int *Port)

Retrieves peer information.

Parameters:

Returns: true on success, false otherwise.

bool  getHost (string *Host, int *Port)

Retrieves local information.

Parameters:

Returns: true on success, false otherwise.

void  setWatch (IOWatch *watch)

Registers an IOWatch for this socket. This IOWatch gets the socket added/removed automatically.

Parameters:


Generated by: felfert@floh.fe.think on Mon Jul 23 21:42:43 2001, using kdoc 2.0a40.