diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-07-24 16:52:24 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-07-24 16:52:24 +0200 |
commit | 6a00886804c53883d919f008f6ec47a574d86607 (patch) | |
tree | 2dbe9fdb0a0d5f068770d49a3c960d36958f27d5 /src/network/NetworkClient.hpp | |
parent | 2017-07-21 (diff) | |
download | AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.gz AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.bz2 AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.lz AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.xz AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.zst AltCraft-6a00886804c53883d919f008f6ec47a574d86607.zip |
Diffstat (limited to 'src/network/NetworkClient.hpp')
-rw-r--r-- | src/network/NetworkClient.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/network/NetworkClient.hpp b/src/network/NetworkClient.hpp new file mode 100644 index 0000000..22b1b22 --- /dev/null +++ b/src/network/NetworkClient.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include <thread> +#include <queue> +#include <mutex> + +#include <network/Network.hpp> + +class NetworkClient { + Network network; + std::thread networkThread; + std::mutex toSendMutex; + std::mutex toReceiveMutex; + std::queue <std::shared_ptr<Packet>> toSend; + std::queue <std::shared_ptr<Packet>> toReceive; + bool isActive=true; + bool &isRunning; + ConnectionState state; + void NetworkLoop(); +public: + NetworkClient(std::string address, unsigned short port, std::string username, bool &quit); + ~NetworkClient(); + + std::shared_ptr <Packet> ReceivePacket(); + void SendPacket(std::shared_ptr<Packet> packet); +};
\ No newline at end of file |