Skip to content

Commit 008a20d

Browse files
authored
update readme (#36)
1 parent 17e08ea commit 008a20d

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

README.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ Socket::initSocket(domain, type, protocol); // creates socket
3838
// create socket from previously created file descriptor
3939
Socket(int);
4040

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
4242
Socket(domain, type, protocol);
43-
44-
4543
```
4644
4745
### TCP server/client
@@ -92,18 +90,6 @@ SecureTcpClient(const int filedescriptor, SSL_CTX *sslctx);
9290
SecureTcpClient(const std::string& ipAddr, const uint16_t port);
9391
```
9492
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-
10793
```cpp
10894
// Client
10995
@@ -133,20 +119,24 @@ UdpClient();
133119
UdpClient(const std::string& ipAddr, const uint16_t port) noexcept(false)
134120
```
135121

136-
For a BSD-like approach, the following sequence can be followed:
122+
Create a SSL UDP Server for accepting SSL UDP clients.
137123

138124
```cpp
139-
// Server
125+
// Create a SSL UDP Server not bound to IP/port
126+
SecureUdpServer(const std::string& keyFile, const std::string& certFile);
140127

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");
143130
```
144131
132+
Create a SSL UDP client for connecting to SSL UDP servers.
133+
145134
```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);
147137
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);
150140
```
151141

152142
## Thread Safety

0 commit comments

Comments
 (0)