🟨 Synchronous socket networking and DNS lookup
Socket library allows creating TCP / UDP sockets and using them as client or server and resolving DNS.
It can be used standalone if synchronous networking is preferred or as a companion to Async for creation of non-blocking socket descriptors.
Class | Description |
---|---|
SC::SocketServer | Use a SocketDescriptor as a Server (example TCP Socket Server). |
SC::SocketClient | Use a SocketDescriptor as a client (example TCP Socket Client). |
SC::SocketIPAddress | Native representation of an IP Address. |
SC::SocketNetworking | DNS Resolution and globals initialization (Winsock2 WSAStartup) |
🟨 MVP
Simple synchronous TCP client / server workflow is supported, but it would need better testing.
SC::SocketServer can SC::SocketServer::listen on a given port / address and SC::SocketServer::accept a new client socket. SC::SocketClient can SC::SocketClient::connect, SC::SocketClient::write, SC::SocketClient::read and SC::SocketClient::readWithTimeout.
SC::SocketIPAddress allows creating an ip address native object from a SC::StringView and port.
SC::SocketNetworking class allow resolving a StringView to an IP address.
Example:
The socket client can be obtained via SC::SocketServer::accept or connected to an endpoint through SC::SocketClient::connect Example (accepted client from server, doing a synchronous read):
Example (connecting client to server, doing two synchronous writes):
Example:
[in] | host | The host string (example.com) |
[out] | ipAddress | The ip address of the given host string |
Example:
🟩 Usable
🟦 Complete Features:
💡 Unplanned Features: