<commit_before>[![Codecov](https://img.shields.io/codecov/c/github/DavidUser/cpp-simple-sockets.svg)](https://codecov.io/gh/DavidUser/cpp-simple-sockets/)

[![Travis](https://img.shields.io/travis/DavidUser/cpp-simple-sockets.svg?maxAge=3600&label=build:%20GCC%205%20|%20C%2b%2b17%20)](https://travis-ci.org/DavidUser/cpp-simple-sockets)
[![Travis](https://img.shields.io/travis/DavidUser/cpp-simple-sockets.svg?maxAge=3600&label=build:%20Clang%203.3%20|%20C%2b%2b17%20)](https://travis-ci.org/DavidUser/cpp-simple-sockets)

[
  ![Quality gate](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=alert_status)
  ![Security](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=security_rating)
  ![Maintainability](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=sqale_rating)
  ![Reliability](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=reliability_rating)
](https://sonarcloud.io/dashboard?id=cpp-simple-sockets)

[
  ![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=vulnerabilities)
  ![Lines](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=ncloc)
  ![Duplication](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=duplicated_lines_density)
  ![Bugs](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=bugs)
](https://sonarcloud.io/dashboard?id=cpp-simple-sockets)

# cpp-simple-sockets
An stupid library to use sockets easy. 

## Client-Server
Client-server applications can be **simple** writed like below.

### Client side

```c++
Connection server("localhost", "12345"); // Open a connection with the server.

server << "Hey server, are you here?" << std::endl; 

string response;
server >> response;
```

### Server side

```c++
Connection client(12345); // Waits for client connections on 12345

// Everything bellow will be asynchronously executed to each client connected.
string question;
client >> question;

client << "Hi client. I'm your server." << std::endl;
```


# Current features
* Output buffer to socket asio;
* Input buffer to sockets asio;
* Client socket stream;
* Server socket stream;
* Server socket stream factory;
* Connection behaviour like client side and multiclient server side;

## Builds
* This Dockerfile build and test on ubuntu with gcc.
    Build and run that container with command:

    ```
    sudo docker build -t daviduser/cpp-simple-sockets<commit_msg>Doc: fix build explanation<commit_after>[![Codecov](https://img.shields.io/codecov/c/github/DavidUser/cpp-simple-sockets.svg)](https://codecov.io/gh/DavidUser/cpp-simple-sockets/)

[![Travis](https://img.shields.io/travis/DavidUser/cpp-simple-sockets.svg?maxAge=3600&label=build:%20GCC%205%20|%20C%2b%2b17%20)](https://travis-ci.org/DavidUser/cpp-simple-sockets)
[![Travis](https://img.shields.io/travis/DavidUser/cpp-simple-sockets.svg?maxAge=3600&label=build:%20Clang%203.3%20|%20C%2b%2b17%20)](https://travis-ci.org/DavidUser/cpp-simple-sockets)

[
  ![Quality gate](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=alert_status)
  ![Security](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=security_rating)
  ![Maintainability](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=sqale_rating)
  ![Reliability](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=reliability_rating)
](https://sonarcloud.io/dashboard?id=cpp-simple-sockets)

[
  ![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=vulnerabilities)
  ![Lines](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=ncloc)
  ![Duplication](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=duplicated_lines_density)
  ![Bugs](https://sonarcloud.io/api/project_badges/measure?project=cpp-simple-sockets&metric=bugs)
](https://sonarcloud.io/dashboard?id=cpp-simple-sockets)

# cpp-simple-sockets
An stupid library to use sockets easy. 

## Client-Server
Client-server applications can be **simple** writed like below.

### Client side

```c++
Connection server("localhost", "12345"); // Open a connection with the server.

server << "Hey server, are you here?" << std::endl; 

string response;
server >> response;
```

### Server side

```c++
Connection client(12345); // Waits for client connections on 12345

// Everything bellow will be asynchronously executed to each client connected.
string question;
client >> question;

client << "Hi client. I'm your server." << std::endl;
```


# Current features
* Output buffer to socket asio;
* Input buffer to sockets asio;
* Client socket stream;
* Server socket stream;
* Server socket stream factory;
* Connection behaviour like client side and multiclient server side;

## Builds
* This Dockerfile build and test on ubuntu with gcc.
    Build and run that container with command:

    ```
    sudo docker build -t daviduser/cpp-simple-sockets .
{'fraction_non_alphanumeric': 0.15443866743693432, 'fraction_numerical': 0.02079722703639515, 'mean_word_length': 6.018918918918919, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 32, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5117288', 'n_tokens_mistral': 1844, 'n_tokens_neox': 1719, 'n_words': 280}