Function Socket.getPeerName

get the name of the socket's peer (for connected sockets only)

SockAddr getPeerName () @nogc @trusted;

Throws

ErrnoException (ENOTCONN) if called on an unconnected socket.