user601836
user601836

Reputation: 3235

erlang:is_port/1 and sockets

I was reading more about erlang:is_port/1 so I decided to test it with several values.

I saw that with normal sockets it replies true if the socket is up and false otherwise (i.e. socket is down).

Can is_port/1 be used also with ssl sockets? I tried but it always returns false.

Upvotes: 3

Views: 235

Answers (1)

Roberto Aloi
Roberto Aloi

Reputation: 30985

If you refer to a SSL Socket as the returned value from (for example) ssl:connect/2,3, then the answer is "no". The SSL Sockets in the context of the SSL application are of a sslsocket() type, which, according to the documentation are opaque to the user and definitely not a port. Specifically, they are records:

%% Looks like it does for backwards compatibility reasons
-record(sslsocket, {fd = nil, pid = nil}).

Upvotes: 3

Related Questions