How to get port number of ephemeral port?

If I do,

using Sockets
l = listen(IPv4("127.0.0.1"),0)

then I’ve created a socket to listen on ephemeral port. Is there a way from Julia to get the port number so I know where to connect to from the other process? Thanks.

Ah methodswith(typeof(l)) gave me a hint where to look and looks like,

convert(Int,getsockname(l)[2])

is my answer.