FeatherMC/src/network/TCPListener.h

28 lines
518 B
C
Raw Normal View History

2020-07-25 03:01:16 +01:00
#pragma once
#include "TCPCommon.h"
2020-07-29 01:46:31 +01:00
2020-07-25 03:01:16 +01:00
#include <cstdint>
#include <memory>
namespace Feather::Network
{
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();
2020-08-01 04:54:31 +01:00
protected:
friend class TCPClient;
2020-08-01 06:48:14 +01:00
void OnClientConnect(TCPClientHandle&& client);
2020-08-01 04:54:31 +01:00
void OnClientDisconnected(const TCPClient* client);
2020-07-25 03:01:16 +01:00
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;
};
2020-08-01 00:57:33 +01:00
}