![]() |
AnCH Framework
0.1
Another C++ Hack Framework
|
#include <tcpSocket.hpp>
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 |
![]() | |
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) |
![]() | |
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 | |
![]() | |
Socket (anch::network::SocketType type) | |
![]() | |
SOCKET | _sock |
int | _backlog |
addrinfo * | _address |
TCP socket implementation
TcpSocket::TcpSocket | ( | ) |
TcpSocket default constructor
TcpSocket::TcpSocket | ( | const std::string & | ipAddress, |
uint16_t | port | ||
) | |||
throw | ( | anch::network::IOException | |
) |
TcpSocket constructor
ipAddress | The IP address |
port | The port number |
anch::network::IOException | Error while creating the socket |
TcpSocket constructor
ipAddress | The IP address |
port | The port number |
IOException | any error |
|
virtualnoexcept |
TcpSocket destructor
|
virtual |
|
virtual |
|
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.