From 48f8a7dcf28ed34e88c7b91eb509b704586bb996 Mon Sep 17 00:00:00 2001 From: Shwoomple <> Date: Tue, 30 Aug 2022 00:51:53 +0530 Subject: [PATCH] tools/hexnet: start implementing console input --- src/tools/hexnet.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tools/hexnet.cpp b/src/tools/hexnet.cpp index af64d68..5efb5f2 100644 --- a/src/tools/hexnet.cpp +++ b/src/tools/hexnet.cpp @@ -84,6 +84,16 @@ void signalHandler(int signal) { std::exit(signal); } +void readFromConsole(){ + while(!exitProgram){ + char * test = new char[420]; + consoleMutex.lock(); + std::cout << "> "; + std::cin.read(test, 1); + consoleMutex.unlock(); + } +} + void readFromTCPSocket(sockpp::tcp_socket* socket, int64_t mtu) { ssize_t numBytes; uint8_t buffer[mtu]; @@ -91,9 +101,11 @@ void readFromTCPSocket(sockpp::tcp_socket* socket, int64_t mtu) { while (!exitProgram && (numBytes = socket->read(buffer, sizeof(buffer))) > 0) { tcpSocketMutex.unlock(); consoleMutex.lock(); + std::cout << "\n"; for (ssize_t i=0; i