Получите Порт -Эрланг

{ok, {Address, Port}} = inet:peername(Socket).
James Cook