@@ -38,10 +38,8 @@ Socket::initSocket(domain, type, protocol); // creates socket
38
38
// create socket from previously created file descriptor
39
39
Socket(int);
40
40
41
- // create socket of the given type
41
+ // create socket of the given type - NOTE: This returns a Socket class type that is not a Tcp or Udp socket class
42
42
Socket(domain, type, protocol);
43
-
44
-
45
43
```
46
44
47
45
### TCP server/client
@@ -92,18 +90,6 @@ SecureTcpClient(const int filedescriptor, SSL_CTX *sslctx);
92
90
SecureTcpClient(const std::string& ipAddr, const uint16_t port);
93
91
```
94
92
95
- For a BSD-like approach, the following sequence can be followed:
96
-
97
- ```cpp
98
- // Server
99
-
100
- // create server socket and bind to all IP and 54321 port
101
- TcpServer server(54321);
102
-
103
- // wait for a client connection
104
- TcpClient client = server.accept();
105
- ```
106
-
107
93
```cpp
108
94
// Client
109
95
@@ -133,20 +119,24 @@ UdpClient();
133
119
UdpClient(const std::string& ipAddr, const uint16_t port) noexcept(false)
134
120
```
135
121
136
- For a BSD-like approach, the following sequence can be followed:
122
+ Create a SSL UDP Server for accepting SSL UDP clients.
137
123
138
124
``` cpp
139
- // Server
125
+ // Create a SSL UDP Server not bound to IP/port
126
+ SecureUdpServer (const std::string& keyFile, const std::string& certFile);
140
127
141
- // create server socket bound to all IP and 54321 port
142
- UdpServer server(54321 );
128
+ // Create a SSL UDP Server bound to a given port and IP or default IP
129
+ SecureUdpServer(const std::string& keyFile, const std::string& certFile, const uint16_t port, const std::string& ipAddr = "0.0.0.0" );
143
130
```
144
131
132
+ Create a SSL UDP client for connecting to SSL UDP servers.
133
+
145
134
```cpp
146
- // Client
135
+ // Create a SSL UDP Client not attempting to connect to a SSL UDP Server (need to call SecureUdpClient::connect(IP, port) to connect)
136
+ SecureUdpClient(const std::string& keyFile, const std::string& certFile);
147
137
148
- // Connect to UDP server on IP 127.0.0.1 and port 54321
149
- UDPClient client ("127.0.0.1", 54321 );
138
+ // create a SSL UDP client connected to a given SSL UDP server waiting in a SecureUdpServer::accept call on the given IP and port
139
+ SecureUdpClient(const std::string& ipAddr, const uint16_t port, const std::string& keyFile, const std::string& certFile );
150
140
```
151
141
152
142
## Thread Safety
0 commit comments