Command-line server and client in C++ using asynchronous communication using boost ASIO.
- Boost libraries
sudo apt -y install libboost-dev
- CMake >= 3.13
- Compiler which supports C++14 (Note: Currently tested only with GCC).
git clone https://github.com/Paulls20/async_client_server.git
mkdir build && cd build
cmake ..
make
make install
make install
installs the binaries to the bin
directory.
cd ../bin
./async_server
[2019-03-09 16:02:13.769580] [0x00007f68e0dfb740] [info] Server Started. Listening to port 3333
By default server starts listening to port 3333
. But ofcourse you can change the port with --port arg as shown.
./async_server -h
Options:
-h [ --help ] Help screen
--port arg (=3333) Port Number
Open the bin
directory in another terminal:
./async_client
IP: 127.0.0.1
Port: 3333
Enter request: Hello World
Response:Hello World back
By default the client connects to 127.0.0.1
and port 3333
. Like the server, you can also start the client to connect to a different host and port as shown.
./async_client -h
Options:
-h [ --help ] Help screen
--port arg (=3333) Port
--ip arg (=127.0.0.1) IP Address
- In the current implementation Server runs only for 60 seconds.
- Client's response buffer size is set to 128 bytes.