1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2026-05-03 09:17:19 +02:00
Files
SqMod/vendor/POCO/Net/testsuite/src/EchoServer.h
T
Sandu Liviu Catalin 233fc103f9 Update POCO library.
2023-03-23 20:19:11 +02:00

60 lines
1.1 KiB
C++

//
// EchoServer.h
//
// Definition of the EchoServer class.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef EchoServer_INCLUDED
#define EchoServer_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/Thread.h"
#include "Poco/Event.h"
#include <atomic>
class EchoServer: public Poco::Runnable
/// A simple sequential echo server.
{
public:
EchoServer();
/// Creates the EchoServer.
EchoServer(const Poco::Net::SocketAddress& address);
/// Creates the EchoServer using the given address.
~EchoServer();
/// Destroys the EchoServer.
Poco::UInt16 port() const;
/// Returns the port the echo server is
/// listening on.
void run();
/// Does the work.
void stop();
/// Sets the stop flag.
bool done();
/// Retruns true if if server is done.
private:
Poco::Net::ServerSocket _socket;
Poco::Thread _thread;
Poco::Event _ready;
std::atomic<bool> _stop;
std::atomic<bool> _done;
};
#endif // EchoServer_INCLUDED