The Micro C++ Library
micxx::ClientSocket Class Reference

A ClientSocket represents a Transmission Control Protocol (TCP) client endpoint of a StreamSocket. More...

#include <micxx.hxx>

Inherits micxx::StreamSocket.

Inherited by micxx::SSLClientSocket.

List of all members.

Public Member Functions

 ClientSocket ()
 Create a new unbound, disconnected ClientSocket.
virtual void connect (const SocketAddress &socketAddress)
 Connect this socket to a server endpoint at the specified SocketAddress socketAddress.

Protected Member Functions

 ClientSocket (socket_t rawSocket, SocketAddress *socketAddress)
 Create a ClientSocket to an already connected rawSocket socket descriptor bound to the specified socketAddress.

Friends

class ServerSocket

Detailed Description

A ClientSocket represents a Transmission Control Protocol (TCP) client endpoint of a StreamSocket.

Example:

 micxx::InetAddress inetAddress("127.0.0.1", 8000);
 micxx::ClientSocket socket;
 socket.connect(inetAddress);
 ...
 socket.send(...);
 socket.recv(...);
 ...
 socket.close();
Note:
Although ClientSocket is derived from Mutex, itself does no locking at all. If you intend to use ClientSocket concurrently from different threads, you could use the inherited Mutex to synchronize access to the instance (depending on the scenario in which it is used).
Author:
Norbert Klose
Date:
February, 2007

Constructor & Destructor Documentation

micxx::ClientSocket::ClientSocket ( )

Create a new unbound, disconnected ClientSocket.

micxx::ClientSocket::ClientSocket ( socket_t  rawSocket,
SocketAddress socketAddress 
) [protected]

Create a ClientSocket to an already connected rawSocket socket descriptor bound to the specified socketAddress.

Parameters:
rawSocketthe socket descriptor
socketAddressthe socket address to be used internally. This socket takes ownership of the allocated SocketAdress and gets responsible for deleting it
See also:
ServerSocket::accept(),
ServerSocket::createSocket(socket_t, SocketAddress*),
SSLClientSocket::SSLClientSocket(socket_t, SocketAddress*)

Member Function Documentation

virtual void micxx::ClientSocket::connect ( const SocketAddress socketAddress) [virtual]

Connect this socket to a server endpoint at the specified SocketAddress socketAddress.

Reimplemented in micxx::SSLClientSocket.


Friends And Related Function Documentation

friend class ServerSocket [friend]

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