We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There seems to be a bug in the server example about incoming msg size.
To reproduce:
seems to be a bug in message size
The text was updated successfully, but these errors were encountered:
I think, this should fix it:
void Client::receiveTask() { while(isConnected()) { const fd_wait::Result waitResult = fd_wait::waitFor(_sockfd); if (waitResult == fd_wait::Result::FAILURE) { throw std::runtime_error(strerror(errno)); } else if (waitResult == fd_wait::Result::TIMEOUT) { continue; } char receivedMessage[MAX_PACKET_SIZE]; const size_t numOfBytesReceived = recv(_sockfd.get(), receivedMessage, MAX_PACKET_SIZE, 0); if(numOfBytesReceived < 1) { const bool clientClosedConnection = (numOfBytesReceived == 0); std::string disconnectionMessage; if (clientClosedConnection) { disconnectionMessage = "Client closed connection"; } else { disconnectionMessage = strerror(errno); } setConnected(false); publishEvent(ClientEvent::DISCONNECTED, disconnectionMessage); return; } else { // fix here receivedMessage[numOfBytesReceived] = '\0'; // fix here publishEvent(ClientEvent::INCOMING_MSG, receivedMessage); } } }
Sorry, something went wrong.
see PR
No branches or pull requests
There seems to be a bug in the server example about incoming msg size.
To reproduce:
seems to be a bug in message size
The text was updated successfully, but these errors were encountered: