So here's my problem: when I make a new socket, I want the OS to assign a port to it:
That works fine, but now I want to know what port the OS assigned to my socket... Is there a function or something to get this value? Because when I've binded the socket and do something likeCode:local.sin_port = htons(0);
it just prints "Port: 0"Code:// bind() and stuff here
printf("Port: %d\n",local.sin_port)