Chops Net IP
Loading...
Searching...
No Matches
chat_server_demo.cpp File Reference

Example of TCP multichat server network program. More...

#include <iostream>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <chrono>
#include <thread>
#include <utility>
#include <cassert>
#include "net_ip/net_ip.hpp"
#include "net_ip/net_entity.hpp"
#include "net_ip_component/worker.hpp"
#include "net_ip_component/send_to_all.hpp"
#include "net_ip/io_type_decls.hpp"
Include dependency graph for chat_server_demo.cpp:

Typedefs

using io_context = asio::io_context
 
using io_output = chops::net::tcp_io_output
 
using io_interface = chops::net::tcp_io_interface
 
using const_buf = asio::const_buffer
 
using endpoint = asio::ip::tcp::endpoint
 

Functions

bool process_args (int argc, char *const argv[], std::string &ip_addr, std::string &port, bool &print_errors)
 
int main (int argc, char *argv[])
 

Detailed Description

Example of TCP multichat server network program.

Author
Thurman Gillespy

Copyright (c) 2019 Thurman Gillespy 2019-10-28

Updated 2025-04-23 by Cliff Green for library dependency changes

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Sample make file: g++ -std=c++17 -Wall -Werror \ -I ../include \ -I ../../utility-rack/include/ \ -I ../../utility-rack/third_party/ \ -I ../../asio/asio/include/ \ chat_server_demo.cpp -lpthread -o chat_server

Typedef Documentation

◆ const_buf

typedef asio::const_buffer const_buf = asio::const_buffer
@fille

@ingroup example_module

@brief UDP reciever demo. Receive text messages from UDP broadcast agent.

@author Thurman Gillespy

@copyright (c) Thurman Gillespy
9/2/19

Distributed under the Boost Software License, Version 1.0. 
(See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Sample make file. Assumes all repositories are in same directory

g++ -std=c++17 -Wall -Werror \ -I ../include \ -I ../../utility-rack/include/ \ -I ../../utility-rack/third_party/ \ -I ../../asio/asio/include/ \ udp_receiver_demo.cpp -lpthread -o udp_receive

◆ io_context

typedef asio::io_context io_context = asio::io_context
@file

@ingroup example_module

@brief TCP connector (client) that sends binary text message to a
server, receives message back converted to upper case.

@author Thurman Gillespy

Copyright (c) Thurman Gillespy
2019-10-21

Updated 2025-04-23 by Cliff Green for library dependency changes

Distributed under the Boost Software License, Version 1.0. 
(See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Sample make file:

g++ -std=c++17 -Wall -Werror \ -I ../include \ -I ../../utility-rack/include/ \ -I ../../utility-rack/third_party/ \ -I ../../asio/asio/include/ \ echo_binary_text_client_demo.cpp -lpthread -o echo_client

@file

@ingroup example_module

@brief TCP acceptor (server) that receives binary text messages, converts
to upper case, then echos back to TCP connector (client).

@author Thurman Gillespy

Copyright (c) Thurman Gillespy
2019-10-21

Updated 2025-04-23 by Cliff Green for library dependency changes

Distributed under the Boost Software License, Version 1.0. 
(See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Sample make file:

g++ -std=c++17 -Wall -Werror \ -I ../include \ -I ../../utility-rack/include/ \ -I ../../utility-rack/third_party/ \ -I ../../asio/asio/include/ \ echo_binary_text_server_demo.cpp -lpthread -o echo_server