🟨 Synchronous socket networking and DNS lookup
SaneCppSocket.h is a library implementing synchronous socket networking and DNS lookup.
| Class | Description |
|---|---|
| SC::SocketDescriptor | Low-level OS socket handle. |
| SC::SocketServer | Use a SocketDescriptor as a Server (example TCP or UDP Socket Server). |
| SC::SocketClient | Use a SocketDescriptor as a client (example a TCP or UDP socket client). |
| SC::SocketIPAddress | Native representation of an IP Address. |
| SC::SocketDNS | Synchronous DNS Resolution. |
| SC::SocketNetworking | Networking globals initialization (Winsock2 WSAStartup) |
🟨 MVP
Simple synchronous TCP client / server workflow is supported, but it would need better testing.
Some relevant blog posts are:
It also allow querying inheritability and changing it (and blocking mode)
Example (extracted from unit test):
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:
Example:
🟩 Usable
🟦 Complete Features:
💡 Unplanned Features:
| Type | Lines Of Code | Comments | Sum |
|---|---|---|---|
| Headers | 123 | 189 | 312 |
| Sources | 608 | 141 | 749 |
| Sum | 731 | 330 | 1061 |