Newer
Older
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2020-2021 Florian Fischer
#include <string> // for string, allocator
#include <vector> // for vector
#include "CountingPrivateSemaphore.hpp" // for CPS
#include "emper.hpp" // for async, spawn
#include "fixtures/network.hpp" // for echo_client, echo_serve
#include "io.hpp" // for tcp_listener
#define MAX 1024
int PORT = 4242;
std::string ADDR = "127.0.0.1";
void emperTest() {
CPS cps;
async(emper::io::tcp_listener(ADDR, PORT, echo_serve));
spawn(
[] {
const std::vector<std::string> strings = {"foo", "bar", std::string(MAX, 'a'), "quit\n"};
echo_client(ADDR.c_str(), PORT, strings);
},
cps);
cps.wait();
}