AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
anch::network::TcpSocket Class Reference

#include <tcpSocket.hpp>

Inheritance diagram for anch::network::TcpSocket:
Collaboration diagram for anch::network::TcpSocket:

Public Member Functions

 TcpSocket ()
 
 TcpSocket (const std::string &ipAddress, uint16_t port) throw (anch::network::IOException)
 
virtual ~TcpSocket () noexcept
 
virtual void send (const std::string &message) throw (anch::network::IOException)
 
virtual void receive (std::string &message) throw (anch::network::IOException)
 
virtual int getDomain () const
 
virtual int getType () const
 
- Public Member Functions inherited from anch::network::Socket
 Socket (const std::string &ipAddress, uint16_t port, anch::network::SocketType type=anch::network::SocketType::UNKNOWN) throw (anch::network::IOException)
 
virtual ~Socket () noexcept
 
virtual void bind () throw (anch::network::IOException)
 
virtual void connect () throw (anch::network::IOException)
 
virtual void listen () throw (anch::network::IOException)
 
virtual void accept (Socket &socket) throw (anch::network::IOException)
 
virtual void receive () throw (anch::network::IOException)
 
virtual void shutdown (anch::network::Direction how=anch::network::Direction::BOTH) throw (anch::network::IOException)
 
virtual void close () noexcept
 
const std::string & getIpAddress () const
 
void setIpAddress (const std::string &ipAddress)
 
uint16_t getPort () const
 
void setIpAddress (uint16_t port)
 
anch::network::SocketType getSocketType () const
 
void setSocketType (SocketType type)
 
int getBacklog () const
 
void setBacklog (int backlog)
 
- Public Member Functions inherited from anch::events::Observable< anch::network::SocketEvent >
 Observable ()
 
virtual ~Observable ()
 
bool addObserver (anch::events::Observer< anch::network::SocketEvent > &observer)
 
void removeObserver (anch::events::Observer< anch::network::SocketEvent > &observer)
 
void notifyObservers (const anch::network::SocketEvent &event)
 

Additional Inherited Members

- Protected Member Functions inherited from anch::network::Socket
 Socket (anch::network::SocketType type)
 
- Protected Attributes inherited from anch::network::Socket
SOCKET _sock
 
int _backlog
 
addrinfo * _address
 

Detailed Description

TCP socket implementation

Author
Vincent Lachenal

Constructor & Destructor Documentation

TcpSocket::TcpSocket ( )

TcpSocket default constructor

TcpSocket::TcpSocket ( const std::string &  ipAddress,
uint16_t  port 
)
throw (anch::network::IOException
)

TcpSocket constructor

Parameters
ipAddressThe IP address
portThe port number
Exceptions
anch::network::IOExceptionError while creating the socket

TcpSocket constructor

Parameters
ipAddressThe IP address
portThe port number
Exceptions
IOExceptionany error
TcpSocket::~TcpSocket ( )
virtualnoexcept

TcpSocket destructor

Member Function Documentation

int TcpSocket::getDomain ( ) const
virtual

Get the socket domain

Returns
The POSIX socket domain

Implements anch::network::Socket.

int TcpSocket::getType ( ) const
virtual

Get the socket service type

Returns
The POSIX socket service type

Implements anch::network::Socket.

void TcpSocket::receive ( std::string &  message)
throw (anch::network::IOException
)
virtual

Receive a message on socket

Parameters
messageThe string where to write the message
Exceptions
anch::network::IOExceptionNetwork error while receiving message

Implements anch::network::Socket.

void TcpSocket::send ( const std::string &  message)
throw (anch::network::IOException
)
virtual

Send a message on socket

Parameters
messageThe message to send
Exceptions
anch::network::IOExceptionNetwork error while sending message

Implements anch::network::Socket.


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