Normally, it is pretty hard to implement a TCP server and client with a proper thread system in the C++ language. To support newbie's desire to make their own TCP communication system, I planned its project.
So, it will contain several systems like below,
- File log system
- Concurrency control by the thread pool system
- Serializable data packet container
- Asynchronous multi-session TCP server
- Asynchronous TCP Client
And, it will provide functions like below,
- Callback functions for each sequence such as connection, receiving data and receiving file
- Send packet to specific target client
- Send packet to all connected clients
- Send files between main server and middle server
- Packet compress and encrypt
Before building this project, you have to download and build vcpkg. Secondly, should install libraries like below followed vcpkg install rule,
- asio library: to support network implement
- fmt library: to support string formatting
- cryptopp library: to support data encryption
- lz4 library: to support data compression
- crossguid library: to support creating guid
- cpprestsdk library: to support REST-API server & client
After all installations, you can build this project on Both Linux and Windows
To understand how to use this library, it provided several sample programs on the samples folder.
- logging_sample: implemented how to use logging
- container_sample: implemented how to use data container
- threads_sample: implemented how to use priority thread with job or callback function
- echo_server: implemented how to use network library for creating an echo server
- echo_client: implemented how to use network library for creating an echo client
- download_sample: implemented how to use file download via provided micro-server on the micro-services folder
- upload_sample: implemented how to use file upload via provided micro-server on the micro-services folder
- restapi_client_sample: implemented how to use REST-API via provided micro-server on the micro-services folder
Note: This license has also been called the "New BSD License" or "Modified BSD License". See also the 2-clause BSD License.
Copyright 2021 🍀☀🌕🌥 🌊
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Please report issues or questions here: https://github.com/kcenon/messaging_system/issues