   How can I find which port my UDP socket is bound to?
  I am creating a socket and doing sendto to the serverSocketo = ::socket ( AF_INET, SOCK_DGRAM, 0 ) ;...::sendto ( Socketo, data (), size (), 0, reinterpret_cast<const sockaddr *> ( & Sockaddr_ino ), sizeof Sockaddr_ino ) ;...On the Client side I want to know which Port was automatically assigned to Socketo.   
  getsockname() does that.However, you should usually not care, as normally the only reason why you would want to know is because you want to recfrom() later on client side. However, in fact, for this you don't need to know, as sendto() already implicitely binds the socket to whatever port the operating system chose.For a server, you would call bind() explicitely anyway and you would therefore know the port.   ;  Thanks. It works like a charm. The scenario is this: I spawn severall Clients from the same Executable, and each Instance needs to write its own Log File.For debugging Purposes it's handy to append the Port number to the Log File name.   