7#include "./network_socket.h"
9namespace AsyncBsdSocketLib
16 static const int cBacklog{3};
18 struct sockaddr_in mAddress;
45 template <std::
size_t N>
46 ssize_t
Send(const std::array<uint8_t, N> &buffer) const noexcept
63 template <std::
size_t N>
64 ssize_t
Receive(std::array<uint8_t, N> &buffer)
const noexcept
66 ssize_t _result = recv(mConnection, buffer.data(), N, 0);
TCP/IP network socket.
Definition: network_socket.h:13
TCP listener (server) to accept a TcpClient.
Definition: tcp_listener.h:14
ssize_t Send(const std::array< uint8_t, N > &buffer) const noexcept
Send a byte array to the connected client.
Definition: tcp_listener.h:46
TcpListener(std::string ipAddress, uint16_t port)
Constructor.
bool TryAccept() noexcept
Try to accept a client to form a connection.
bool TryMakeConnectionNonblock() noexcept
Try to make the current connection (if exists) non-block.
bool TrySetup() noexcept override
Try to setup the communicator.
TcpListener(uint16_t port)
Constructor to listen on any IP address.
ssize_t Receive(std::array< uint8_t, N > &buffer) const noexcept
Receive a byte array from the connected client.
Definition: tcp_listener.h:64
int Connection() const noexcept override
Connection descriptor for sending and receiving.