libBsdSockets
C++ Wrapper classes to the BSD Socket API
BsdSockets::ClientSocket Class Reference

Client Socket providing ability to connect to and Address. More...

#include <ClientSocket.h>

Inheritance diagram for BsdSockets::ClientSocket:
Collaboration diagram for BsdSockets::ClientSocket:

Public Types

typedef std::shared_ptr< ClientSocketPtr
 
- Public Types inherited from BsdSockets::Socket
typedef std::shared_ptr< SocketPtr
 

Public Member Functions

virtual ~ClientSocket ()
 
void connect () const
 
- Public Member Functions inherited from BsdSockets::Socket
virtual ~Socket ()
 
SelectResult select (int timeout_ms, bool checkRead, bool checkWrite, bool checkError)
 
short poll (int timeout_ms, short eventsToLookFor)
 
ssize_t send (const void *buffer, size_t length, int flags=0) const
 
ssize_t receive (void *buffer, size_t length, int flags=0) const
 
ssize_t blockingReceive (void *buffer, size_t length) const
 
void getSocketOption (int level, int optionName, void *optionValue, socklen_t *optionLength) const
 
void setSocketOption (int level, int optionName, const void *optionValue, socklen_t optionLength) const
 
int getLowLevelSocket () const
 
std::shared_ptr< AddressgetAddress () const
 

Static Public Member Functions

static ClientSocket::Ptr create (std::shared_ptr< Address > theAddress)
 
static ClientSocket::Ptr open (std::shared_ptr< Address > theAddress)
 
- Static Public Member Functions inherited from BsdSockets::Socket
static Socket::Ptr create (std::shared_ptr< Address > theAddress, int existingLowLevelSocket)
 

Protected Member Functions

 ClientSocket (std::shared_ptr< Address > theAddress)
 
- Protected Member Functions inherited from BsdSockets::Socket
 Socket (std::shared_ptr< Address > theAddress)
 

Detailed Description

Client Socket providing ability to connect to and Address.

This adds to Socket the ability to connetc() to an address.

Definition at line 35 of file ClientSocket.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<ClientSocket> BsdSockets::ClientSocket::Ptr
Examples
ClientSocketExamples.cpp.

Definition at line 37 of file ClientSocket.h.

Constructor & Destructor Documentation

◆ ~ClientSocket()

BsdSockets::ClientSocket::~ClientSocket ( )
virtual

Closes socket. Virtual destructor to support derived classes.

Definition at line 40 of file ClientSocket.cpp.

◆ ClientSocket()

BsdSockets::ClientSocket::ClientSocket ( std::shared_ptr< Address theAddress)
protected

Create ClientSocket to support an address, saving it for connect().

Parameters
theAddressto create socket to use

Member Function Documentation

◆ connect()

void BsdSockets::ClientSocket::connect ( ) const

Connect ClientSocket to the address.

Definition at line 43 of file ClientSocket.cpp.

◆ create()

ClientSocket::Ptr BsdSockets::ClientSocket::create ( std::shared_ptr< Address theAddress)
static

Create a ClientSocket to theAddress.

Note
The caller still needs to connect()
Parameters
theAddressto open and connect the ClientSocket to
Returns
the ClientSocket
Examples
ClientSocketExamples.cpp.

Definition at line 25 of file ClientSocket.cpp.

◆ open()

ClientSocket::Ptr BsdSockets::ClientSocket::open ( std::shared_ptr< Address theAddress)
static

Create and connect a ClientSocket to theAddress.

Parameters
theAddressto open the ClientSocket to
Returns
the ClientSocket

Definition at line 29 of file ClientSocket.cpp.


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