Answer the question
In order to leave comments, you need to log in
QUdpSocket stops reading the port after some time if it sends messages to a closed port, how to fix it?
I have a udp socket that I bind to a port and read/send data from it. Everything works well, BUT if I close the port where I send messages, the destination port is unreachable response logically begins to arrive and after a while the socket simply unbinds and even if you raise the server where it sent messages, it will no longer work (as well as accepting and send). I also need that even if the server where he sends messages lies, he still continued to send messages to him until he gets up. How quickly a socket is disconnected when the server is down depends on how many messages to send to it. Like found as this problem solves for WinSOCK:
DWORD dwBytesReturned = 0;
int bNewBehavior = 1;
if (::WSAIoctl(socket, SIO_UDP_CONNRESET, &bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned, NULL, NULL) == SOCKET_ERROR) {
// not to worry isBogusUdpReadNotification() should handle this otherwise
int err = WSAGetLastError() ;
WS_ERROR_DEBUG(err);
}
The question is how to implement this for QUdpSocket
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question