3#include <EasySockets/Api/SocketTypes.hpp>
4#include <EasySockets/Api/Addresses.hpp>
5#include <EasySockets/Api/Documentation.hpp>
26 ES_API_DOC(socket_default_constructor)
33 ES_API_DOC(socket_constructor)
51 ES_API_DOC(socket_bind_to)
60 ES_API_DOC(socket_connect_to)
67 ES_API_DOC(socket_listen_for_connections)
79 ES_API_DOC(socket_accept_connection)
88 ES_API_DOC(socket_receive_data)
98 ES_API_DOC(socket_receive_data_from)
110 ES_API_DOC(socket_send_data)
118 int64_t
send_data(
const char* buffer,
int buffer_size);
120 ES_API_DOC(socket_send_data_to)
131 ES_API_DOC(socket_close)
184 static addrinfo* resolve_address(
const SocketData& socket_data,
const EndPoint& end_point);
187 SocketData m_socket_data;
void listen_for_connections(int backlog)
Makes the socket start listening for incoming connections.
Definition PosixSocket.cpp:123
PosixSocket()
Default constructs a socket.
Definition PosixSocket.cpp:13
static PosixSocket make_connected_tcp(const EndPoint &end_point)
Makes a TCP socket connected to the given endpoint.
Definition PosixSocket.cpp:231
void connect_to(const EndPoint &end_point)
Connects a socket to the given end point.
Definition PosixSocket.cpp:103
PosixSocket(const PosixSocket &)=delete
PosixSocket accept_connection()
Accepts incoming connections.
Definition PosixSocket.cpp:129
static PosixSocket make_bound_udp(Port port, IpVersion ip_version=IpVersion::DUAL_STACK)
Makes a UDP socket bound to the given port.
Definition PosixSocket.cpp:305
static PosixSocket make_bound_tcp(Port port, IpVersion ip_version=IpVersion::DUAL_STACK)
Makes a TCP socket bound to the given port.
Definition PosixSocket.cpp:291
static PosixSocket make_connected_udp(const EndPoint &end_point)
Makes a UDP socket connected to the given endpoint.
Definition PosixSocket.cpp:261
PosixSocket & operator=(const PosixSocket &)=delete
void bind_to(const EndPoint &end_point)
Binds a socket to the given end point.
Definition PosixSocket.cpp:83
int64_t send_data_to(const char *buffer, int buffer_size, const EndPoint &end_point)
Sends data to the provided end point.
Definition PosixSocket.cpp:187
void close()
Closes the socket.
Definition PosixSocket.cpp:209
int64_t receive_data_from(char *buffer, int buffer_size, EndPoint &sender_end_point)
Waits to receive data from any endpoint.
Definition PosixSocket.cpp:152
int64_t send_data(const char *buffer, int buffer_size)
Sends data to the connected end point.
Definition PosixSocket.cpp:178
int64_t receive_data(char *buffer, int buffer_size)
Waits to receive data from the connected end point.
Definition PosixSocket.cpp:143
Definition Addresses.hpp:7
Represents the address + port that identifies a connection. Initialized by {Address,...
Definition Addresses.hpp:29