FIX:fixed some issues in the tcp client

This commit is contained in:
Henry Winkel
2023-08-09 15:56:35 +02:00
parent 3a195b519c
commit 27987081d7
2 changed files with 3 additions and 2 deletions

View File

@@ -42,7 +42,7 @@ namespace DirectCommunication
std::thread Worker_; std::thread Worker_;
std::atomic_bool stopWorker_; std::atomic_bool stopWorker_;
std::atomic_bool isConnected = true; std::atomic_bool isConnected = false;
std::function<void(std::string)> MessageHandle_ = nullptr; std::function<void(std::string)> MessageHandle_ = nullptr;

View File

@@ -19,6 +19,7 @@ namespace DirectCommunication
socket_.connect("tcp://"+serverAddress_+":"+std::to_string(port_)); socket_.connect("tcp://"+serverAddress_+":"+std::to_string(port_));
socket_.set(zmq::sockopt::rcvtimeo,100); socket_.set(zmq::sockopt::rcvtimeo,100);
socket_.set(zmq::sockopt::sndtimeo,500);
Worker_ = std::thread(&DirectCommunicationClient::workerFunc_,this); Worker_ = std::thread(&DirectCommunicationClient::workerFunc_,this);
stopWorker_ = false; stopWorker_ = false;
@@ -74,7 +75,7 @@ namespace DirectCommunication
if (recv > 0) if (recv > 0)
{ {
isConnected = true;
if (msg.to_string() == "CLOSE") if (msg.to_string() == "CLOSE")
{ {
isConnected = false; isConnected = false;