[erlang-questions] fd and controlling process

Salikhov Dinislam <>
Mon Feb 6 15:12:04 CET 2017


IIUC, {fd, integer() >= 0} allows to use the socket received from 
socket() C function (or somehow else, but I can't propose another way).

 > Is there a way to receive controlling process of the socket?
If we managed to get the port (though I still don't know the way), the 
controlling process can be obtained as following:
{_, Pid} = erlang:port_info(Port, connected).

On 02/06/2017 04:30 PM, Steve Vinoski wrote:
>
>
> On Mon, Feb 6, 2017 at 8:18 AM, Salikhov Dinislam 
> < 
> <mailto:>> wrote:
>
>     Hi!
>
>     I have a Unix file descriptor of Erlang VM process.
>     I know that it is a TCP socket in ESTABLISHED state.
>     Is there a way to receive an Erlang port of the socket?
>     Is there a way to receive controlling process of the socket?
>
>
> See the {fd, integer() >= 0} option that various gen_tcp functions can 
> take:
>
> http://erlang.org/doc/man/gen_tcp.html
>
> --steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170206/863496a4/attachment.html>


More information about the erlang-questions mailing list