Get address and port of a socket end-point.
This function returns the remote or local address of a socket on the
form "x.x.x.x port".
If the argument local is not specified, or is 0 (zero),
the remote address will be returned. Otherwise, if local is
1, the local address will be returned.
If the file is not a socket, not connected, or some other error
occurrs, 0 (zero) will be returned.