#include <tcpSocket.hpp>
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 |
TCP socket implementation
| anch::network::TcpSocket::TcpSocket | ( | ) |
TcpSocket default constructor
| anch::network::TcpSocket::TcpSocket | ( | const std::string & | ipAddress, |
| uint16_t | port ) |
TcpSocket constructor
| ipAddress | the IP address |
| port | the port number |
| anch::network::IOException | Error while creating the socket |
|
virtualnoexcept |
TcpSocket destructor
|
virtual |
Receive a message on socket
| message | the string where to write the message |
| anch::network::IOException | Network error while receiving message |
Implements anch::network::Socket.
|
virtual |
Send a message on socket
| message | the message to send |
| anch::network::IOException | Network error while sending message |
Implements anch::network::Socket.