in this example i guess sf::UdpSocket::Anyport generates a port that's not occupied and assigns it to "port".
and that's what it does because the program displays the port with getlocalport().
the thing is that inside let's call it "server mode":
if (socket.send(buffer, sizeof(buffer), IP, clientPort) != sf::Socket::Done)
here clientPort == 0;
but in "client mode":
if (socket.bind(clientPort) != sf::Socket::Done)
here clientPort contains the port that was assigned with sf::UdpSocket::Anyport;
but when i hard code the ports with a value, like:
unsigned short clientPort = 4001;
clientPort IS assigned 4001 in both "server mode" AND"client mode".
since i don't know what port would be availabe on some other computer, I thought it would be a good idea to let the program find a free port by itself rather than me hardcoding a port value...
please let me know if im thinking wrong here