void ServerSocket_listen(ServerSocket self)
Socket ServerSocket_accept(ServerSocket self)
accept a new incoming connection (non-blocking)
int Socket_read(Socket self, uint8_t *buf, int size)
read from socket to local buffer (non-blocking)
void ServerSocket_destroy(ServerSocket self)
destroy a server socket instance
bool Socket_connect(Socket self, const char *address, int port)
connect to a server
struct sHandleSet * HandleSet
Definition: hal_socket.h:55
ServerSocket TcpServerSocket_create(const char *address, int port)
Create a new TcpServerSocket instance.
HandleSet Handleset_new(void)
Create a new connection handle set (HandleSet)
int Socket_write(Socket self, uint8_t *buf, int size)
send a message through the socket
struct sServerSocket * ServerSocket
Definition: hal_socket.h:49
void Socket_setConnectTimeout(Socket self, uint32_t timeoutInMs)
set the timeout to establish a new connection
int Handleset_waitReady(HandleSet self, unsigned int timeoutMs)
wait for a socket to become ready
struct sSocket * Socket
Definition: hal_socket.h:52
Socket TcpSocket_create(void)
create a TCP client socket
void ServerSocket_setBacklog(ServerSocket self, int backlog)
set the maximum number of pending connection in the queue
char * Socket_getPeerAddress(Socket self)
Get the address of the peer application (IP address and port number)
void Handleset_addSocket(HandleSet self, const Socket sock)
add a socket to an existing handle set
void Handleset_destroy(HandleSet self)
destroy the HandleSet instance
void Socket_destroy(Socket self)
destroy a socket (close the socket if a connection is established)