'How to properly destroy a UDP Socket in QT?

I'm working with QT UDP Sockets. This Socket are part of a "communication" class called, say, Com. It happens, for the needs of my application, that Com need to be deleted. Now, my question is: is it sufficient to invoke delete myUdpSocket; or should I explicitly invoke flush(), 'close()` or whatever? I ask this because when I delete Com the application does not necessairly need to close but instead it it possible that a new Instance of om need to be instantiated and with that a new instance of a UDP Socket on the same port and at the same addresses.



Solution 1:[1]

Yes, deleting the QUdpSocket will close it (and unbind) automatically.

This means that you can create a new instance later on the same port and address.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexandre