2020-07-25 03:01:16 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-29 01:46:31 +01:00
|
|
|
#include "Lockable.h"
|
|
|
|
#include "IListenerInterface.h"
|
|
|
|
|
2020-07-25 03:01:16 +01:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Feather::Network
|
2020-07-28 05:45:03 +01:00
|
|
|
{
|
2020-07-25 03:01:16 +01:00
|
|
|
class TCPSocket;
|
2020-07-25 04:57:54 +01:00
|
|
|
class TCPListenerClient;
|
2020-07-29 01:46:31 +01:00
|
|
|
|
|
|
|
class TCPClient
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TCPClient(std::unique_ptr<TCPListenerClient>&& client);
|
|
|
|
TCPClient(TCPClient&& client);
|
|
|
|
~TCPClient();
|
|
|
|
|
|
|
|
const LockableVector<uint8_t>& GetData() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<TCPListenerClient> m_client;
|
|
|
|
};
|
2020-07-25 03:01:16 +01:00
|
|
|
|
|
|
|
class TCPListener
|
|
|
|
{
|
|
|
|
public:
|
2020-07-29 01:46:31 +01:00
|
|
|
TCPListener(uint16_t port, IListenerInterface* callbacks);
|
2020-07-25 03:01:16 +01:00
|
|
|
~TCPListener();
|
|
|
|
private:
|
2020-07-29 01:46:31 +01:00
|
|
|
IListenerInterface* m_callbacks;
|
2020-07-25 03:01:16 +01:00
|
|
|
std::unique_ptr<TCPSocket> m_socket;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|