Which function tells me what kernel gave as the local socket? : As a client I do a socket(), it gives me a number I store in sktnum.  I then do a connect() with sktnum and the remote address.  Hey presto, it succeeds, and I am told the kernel has selected a local IP address and port number (so as the server will know where to send back to).  What function (linux C/C++) do I call to find out what port and IP address the kernel selected.  (And please don't be one of those people who say "why do you want to know")