hi, On Tue, February 27, 2018 19:47, Igor Mironchik wrote: > Is situation possible that QUdpSocket in bound state can be somehow > disconnected (not from app's code) for any reason? I.e. something wrong > on the network, UDP socket can't work properly, something wrong in the > OS that leads to that UDP socket will not receive any datagrams? I ask > for regular situations that I need to check in my application...
>>> QUdpSocket::bind( somePort, QUdpSocket::ShareAddress ); First off: UDP sockets are not connected - it is a connectionless protocol in which every data packet is routed on its own. Your above code means that the socket will listen on somePort of every open interface and may share this with other programs listening on the same port. I hope you are checking the return code of bind! If this is false then the socket is left in an undefined state. In this state you will not receive any data (or be able to send anything) - you may or may not get errors when you try. If somePort is 0 then the OS will chose a port for you. The assignment is somewhat unpredictable. If somePort is <=1024 then the OS may block your bind attempt, because the port is privileged. If somePort is used exclusively by another program or the OS, then bind will also fail. SomePort may be blocked in your firewall. Or you may simply be mistaken about the port number. You can check those cases with Wireshark. The network interface on which you are hoping to receive data may be down. You can check this with ipconfig (Windows) or ifconfig (Linux/Unix/Mac). Your sending process might be sending to the wrong target address - it needs to send to either one of your interface addresses or a multicast group that your socket has joined. If your sending process has bound its socket then the address must be compatible with the target address (e.g. it is impossible to send from 127.0.0.1 to 192.168.1.2 or from a multicast address). You can check bindings with netstat, you can check whether packets are sent with Wireshark. Your sending process and your receiving process might use different protocols (IPv4 vs. IPv6) if you messed up some settings. You can find out with netstat and Wireshark. Good luck with your diagnosis! Konrad _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest