mirror of
https://github.com/modelec/detection_pot.git
synced 2026-01-19 00:57:28 +01:00
Check if the clientSocket is a non-blocking socket
This commit is contained in:
@@ -252,11 +252,13 @@ void ArucoDetector::setNonBlocking(int sockfd) {
|
||||
int flags = fcntl(sockfd, F_GETFL, 0);
|
||||
if (flags == -1) {
|
||||
// Handle error
|
||||
std::cout << "Error: Could not set socket to non-blocking." << std::endl;
|
||||
perror("fcntl F_GETFL");
|
||||
return;
|
||||
}
|
||||
if (fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) == -1) {
|
||||
// Handle error
|
||||
std::cout << "Error: Could not set socket to non-blocking." << std::endl;
|
||||
perror("fcntl F_SETFL O_NONBLOCK");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user