/*
|
* =====================================================================================
|
*
|
* Filename: tcp_test.cpp
|
*
|
* Description:
|
*
|
* Version: 1.0
|
* Created: 2021年05月24日 09时40分14秒
|
* Revision: none
|
* Compiler: gcc
|
*
|
* Author: Li Chao (), lichao@aiotlink.com
|
* Organization:
|
*
|
* =====================================================================================
|
*/
|
|
#include "tcp_connection.h"
|
#include "tcp_server.h"
|
#include "util.h"
|
#include <sys/ioctl.h>
|
|
//////////////////////
|
|
template <class C, class V>
|
void Erase(C &c, V &&v)
|
{
|
c.erase(std::remove(c.begin(), c.end(), v), c.end());
|
}
|
|
BOOST_AUTO_TEST_CASE(TcpTest)
|
{
|
const std::string bind_addr = "127.0.0.1";
|
const std::string connect_addr = "127.0.0.1";
|
const uint16_t port = 10000;
|
|
TcpServer server(port);
|
server.Start();
|
|
boost::asio::io_context io;
|
|
tcp::endpoint dest(ip::address::from_string(connect_addr), port);
|
for (int i = 0; i < 10; ++i) {
|
TcpRequest1::Create(io, dest, "client->server " + std::to_string(i));
|
}
|
|
io.run();
|
|
printf("TcpTest\n");
|
}
|