AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
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)
virtual ~TcpSocket () noexcept
virtual void send (const std::string &message)
virtual void receive (std::string &message)
Public Member Functions inherited from anch::network::Socket
 Socket (const std::string &ipAddress, uint16_t port, SocketType type=SocketType::UNKNOWN)
virtual ~Socket () noexcept
virtual void bind ()
virtual void connect ()
virtual void listen ()
virtual void accept (Socket &socket)
virtual void receive ()
virtual void shutdown (Direction how=Direction::BOTH)
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< SocketEvent >
 Observable ()
virtual ~Observable ()
bool addObserver (anch::events::Observer< SocketEvent > &observer)
void removeObserver (anch::events::Observer< SocketEvent > &observer)
void notifyObservers (const SocketEvent &event, const std::map< std::string, std::string > &headers={})

Additional Inherited Members

Protected Member Functions inherited from anch::network::Socket
 Socket (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() [1/2]

anch::network::TcpSocket::TcpSocket ( )

TcpSocket default constructor

◆ TcpSocket() [2/2]

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

TcpSocket constructor

Parameters
ipAddressthe IP address
portthe port number
Exceptions
anch::network::IOExceptionError while creating the socket

◆ ~TcpSocket()

virtual anch::network::TcpSocket::~TcpSocket ( )
virtualnoexcept

TcpSocket destructor

Member Function Documentation

◆ receive()

virtual void anch::network::TcpSocket::receive ( std::string & message)
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.

Here is the call graph for this function:

◆ send()

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

Send a message on socket

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

Implements anch::network::Socket.

Here is the call graph for this function:

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