Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stackoverflowexcept1on/tcp-daemon-for-linux
TCP client-server application written in C++20 using Boost.Asio
https://github.com/stackoverflowexcept1on/tcp-daemon-for-linux
boost-asio cmake conan cpp20 linux
Last synced: 4 days ago
JSON representation
TCP client-server application written in C++20 using Boost.Asio
- Host: GitHub
- URL: https://github.com/stackoverflowexcept1on/tcp-daemon-for-linux
- Owner: StackOverflowExcept1on
- Created: 2023-01-12T10:01:31.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-15T19:36:07.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T20:07:22.318Z (about 2 months ago)
- Topics: boost-asio, cmake, conan, cpp20, linux
- Language: C++
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### TCP client & server (C++20 & Boost.Asio)
[![Build Status](https://github.com/StackOverflowExcept1on/tcp-daemon-for-linux/actions/workflows/ci.yml/badge.svg)](https://github.com/StackOverflowExcept1on/tcp-daemon-for-linux/actions/workflows/ci.yml)
[![asciicast](https://asciinema.org/a/zxX8zMCGW5bf8zSJtSe1Z4EI5.svg)](https://asciinema.org/a/zxX8zMCGW5bf8zSJtSe1Z4EI5)
This is one of the cool tasks from my university
### Task description
Implement a multi-threaded client-server application under Linux.
- Client is a program launched from the console
- The server is a daemon that gracefully terminates on `SIGTERM` and `SIGHUP` signals
- The client must transfer the contents of the text file via TCP
- The server must accept connection and save TCP stream to a file### Requirements
- cmake
- conan### Building
```bash
./build.sh
```### Integration with CLion
By default, this may result in an error, to fix this:
1. execute `cd cmake-build-debug && conan install ..`
2. refresh CMake build### Server
```bash
# run server at port 1234
./build/bin/server 1234# check that daemon started
lsof -i :1234# connect to server using netcat
echo "some data" | nc -N 0.0.0.0 1234# read logs of the daemon
grep tcp_server_daemon /var/log/syslog# clear syslog
sudo truncate -s 0 /var/log/syslog
```### Client
```bash
# generate random file
head -c 1G large
sha256sum large# send file to the server
./build/bin/client 127.0.0.1 1234 large
```