Skip to content

Commit

Permalink
update workflow and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
martelkr committed Sep 5, 2023
1 parent a4b0bc4 commit 06fa14a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# These are optional (defaults displayed)
with:
scandir: '.'
builddir: '.'
builddir: 'build'
excludedirs: 'test'
extensions: 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
cmakeoptions: ''
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
![cppcheck Build](https://github.com/martelkr/cppsocket/actions/workflows/cppcheck.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/martelkr/cppsocket/badge.svg?branch=main)](https://coveralls.io/github/martelkr/cppsocket?branch=main)
![cpp-linter](https://github.com/martelkr/cppsocket/actions/workflows/linter.yml/badge.svg)
![Address Sanitization](https://github.com/martelkr/cppsocket/actions/workflows/addressSanitization.yml/badge.svg)
![Code QL](https://github.com/martelkr/cppsocket/actions/workflows/codeql.yml/badge.svg)
![Clang Tidy](https://github.com/martelkr/cppsocket/actions/workflows/clang-tidy.yml/badge.svg)

## About
This is a header file only implementation of a C++ client/server with or without SSL/TLS/DTLS.
Expand All @@ -29,7 +32,7 @@ Create a TCP server object for accepting TCP connections.

```cpp
// default no SSL and not IP/port bound
TCPServer();
TCPServer(void);

// default SSL and not IP/port bound
TCPServer(const std::string& keyFile, const std::string& certFile);
Expand All @@ -54,19 +57,19 @@ For a BSD-like approach, the following sequence can be followed:
// Server

// create server socket
TCPServer s; // add key file and cert file here for secure connection
TCPServer server; // add key file and cert file here for secure connection

// bind to port 54321 on IP 0.0.0.0
s.bindAndListen(54321);
server.bindAndListen(54321);

TCPClient c = s.accept();
TCPClient client = server.accept();
```

```cpp
// Client

// Connect to TCP server on IP 127.0.0.1 and port 54321
TCPClient c("127.0.0.1", 54321); // add key file and cert file here for secure connection
TCPClient client("127.0.0.1", 54321); // add key file and cert file here for secure connection
```
### UDP server/client
Expand All @@ -75,7 +78,7 @@ Create a UDP server object for accepting UDP connections.
```cpp
// default constructor creates unbound unsecure UDP server socket
UDPServer();
UDPServer(void);
// default DTLS constructor create unbound UDP server socket ready for DTLS
// NOTE: UDPServer s("", ""); results in unbound unsecure UDP server socket
Expand All @@ -94,7 +97,7 @@ Create a UDP client object to connect to a known UDP server.
```cpp

// default constructor creates unconnected UDP client socket
UDPClient();
UDPClient(void);

// creates UDP client socket connected to UDP server
UDPClient(const std::string& remoteIp, const uint16_t remotePort);
Expand All @@ -112,20 +115,20 @@ For a BSD-like approach, the following sequence can be followed:
// Server
// create server socket
UDPServer s; // add key file and cert file here for secure connection
UDPServer server; // add key file and cert file here for secure connection
// bind to port 54321 on IP 0.0.0.0
s.bind(54321);
server.bind(54321);
// following not needed for unsecure connection but is needed for DTLS connection
s.accept();
server.accept();
```

```cpp
// Client

// Connect to UDP server on IP 127.0.0.1 and port 54321
UDPClient c("127.0.0.1", 54321); // add key file and cert file here for secure connection
UDPClient client("127.0.0.1", 54321); // add key file and cert file here for secure connection
```
## Thread Safety
Expand Down

0 comments on commit 06fa14a

Please sign in to comment.