Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update readme #36

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ Socket::initSocket(domain, type, protocol); // creates socket
// create socket from previously created file descriptor
Socket(int);

// create socket of the given type
// create socket of the given type - NOTE: This returns a Socket class type that is not a Tcp or Udp socket class
Socket(domain, type, protocol);


```

### TCP server/client
Expand Down Expand Up @@ -92,18 +90,6 @@ SecureTcpClient(const int filedescriptor, SSL_CTX *sslctx);
SecureTcpClient(const std::string& ipAddr, const uint16_t port);
```

For a BSD-like approach, the following sequence can be followed:

```cpp
// Server

// create server socket and bind to all IP and 54321 port
TcpServer server(54321);

// wait for a client connection
TcpClient client = server.accept();
```

```cpp
// Client

Expand Down Expand Up @@ -133,20 +119,24 @@ UdpClient();
UdpClient(const std::string& ipAddr, const uint16_t port) noexcept(false)
```

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

```cpp
// Server
// Create a SSL UDP Server not bound to IP/port
SecureUdpServer(const std::string& keyFile, const std::string& certFile);

// create server socket bound to all IP and 54321 port
UdpServer server(54321);
// Create a SSL UDP Server bound to a given port and IP or default IP
SecureUdpServer(const std::string& keyFile, const std::string& certFile, const uint16_t port, const std::string& ipAddr = "0.0.0.0");
```

Create a SSL UDP client for connecting to SSL UDP servers.

```cpp
// Client
// Create a SSL UDP Client not attempting to connect to a SSL UDP Server (need to call SecureUdpClient::connect(IP, port) to connect)
SecureUdpClient(const std::string& keyFile, const std::string& certFile);

// Connect to UDP server on IP 127.0.0.1 and port 54321
UDPClient client("127.0.0.1", 54321);
// create a SSL UDP client connected to a given SSL UDP server waiting in a SecureUdpServer::accept call on the given IP and port
SecureUdpClient(const std::string& ipAddr, const uint16_t port, const std::string& keyFile, const std::string& certFile);
```

## Thread Safety
Expand Down
Loading