[Qt-interest] QUdpSocket's writeDatagram source port

Valentin Iliu valentiniliu at yahoo.com
Thu Oct 29 09:20:56 CET 2009


No bind(0) means that your OS will chose a port for you. After bind you can 
ask the socket for the one you were given.

Rule of thumb: if you write a client bind to "port 0", so you get any free 
port. If you write a server bind to a specific one (>1024 to be portable), so 
clients can find you.

You still have to filter incoming messages for the ones you are interested 
in - UDP is not connected, so anyone can send you messages to your (randomly) 
assigned port.

	Konrad


Indeed, that's true and thank you for clearing this out for me.
So this means that the callback function will only deal with 
packets coming to this OS chosen port. OK, this makes perfect sense.
Thanks a million Konrad!



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091029/fa6bde36/attachment.html 


More information about the Qt-interest-old mailing list