24#include "events/observable.hpp"
25#include "network/socketEvent.hpp"
26#include "network/ioException.hpp"
35#elif defined ANCH_POSIX
37#define INVALID_SOCKET -1
38#define SOCKET_ERROR -1
40typedef struct sockaddr_in SOCKADDR_IN;
41typedef struct sockaddr SOCKADDR;
96 std::string _ipAddress;
184 virtual
void send(const std::
string& message) = 0;
193 virtual
void receive(std::
string& message) = 0;
249 _ipAddress = ipAddress;
An observable implementation of the observers/observable design pattern.
Definition observable.hpp:44
SOCKET _sock
Definition socket.hpp:106
void setIpAddress(uint16_t port)
Definition socket.hpp:266
virtual int getDomain() const =0
virtual void send(const std::string &message)=0
void setIpAddress(const std::string &ipAddress)
Definition socket.hpp:248
virtual int getType() const =0
virtual void receive(std::string &message)=0
virtual ~Socket() noexcept
virtual void accept(Socket &socket)
addrinfo * _address
Definition socket.hpp:112
Socket(const std::string &ipAddress, uint16_t port, SocketType type=SocketType::UNKNOWN)
int getBacklog() const
Definition socket.hpp:293
void setBacklog(int backlog)
Definition socket.hpp:302
const std::string & getIpAddress() const
Definition socket.hpp:239
anch::network::SocketType getSocketType() const
Definition socket.hpp:275
void setSocketType(SocketType type)
Definition socket.hpp:284
virtual void close() noexcept
virtual void shutdown(Direction how=Direction::BOTH)
uint16_t getPort() const
Definition socket.hpp:257
int _backlog
Definition socket.hpp:109
Network namespace.
Definition ioException.hpp:25
Direction
Definition socket.hpp:75
@ RECEPTION
Definition socket.hpp:77
@ TRANSMISSION
Definition socket.hpp:80
@ BOTH
Definition socket.hpp:83
SocketType
Definition socket.hpp:53
@ POSIX
Definition socket.hpp:65
@ UNKNOWN
Definition socket.hpp:55
@ TCP
Definition socket.hpp:58
@ UDP
Definition socket.hpp:61