[erlang-questions] SSL Example does not work

zxq9 zxq9@REDACTED
Sat Feb 20 14:14:15 CET 2016


On 2016年2月20日 土曜日 12:59:25 Roger Wenham wrote:
> Hi Magnus,
> 
> I did the ssl:start() as you suggested, and it now appears to work. So 
> why is that necessary?
> 
> The program calls:
> 
>     application:start(ssl),
> 
> which I presume would cause ssl:start() to be called... Why is that not 
> enough?
> 
> Also, is it ok to put the ssl:start() inside the program, and why wasn't 
> that done?
> 
> Lastly, Vimal Kumar suggested I use application:ensure_all_started(ssl), 
> would that remove the need for the ssl:start() ?
> 
> Sorry for all the questions :-)


Hi Roger.

The reason that application:start(ssl) doesn't quite cut it is because ssl has, as an Erlang application, a few of its own application dependencies that ssl:start/0,1 takes care of.

https://github.com/erlang/otp/blob/82a835d94be7ee5e98d101a29999fedaf6cd75fe/lib/ssl/src/ssl.erl#L67-L77

Usually you can get away with ensure_started/1, but not in this case, it seems.

-Craig



More information about the erlang-questions mailing list