SSL problem

Alexey Shchepin alexey@REDACTED
Fri Apr 18 14:31:21 CEST 2003


Hi!

There is a following problem with SSL module in Erlang.  In passive
mode you can't send something with ssl:send until another process
executes ssl:recv (which not returns until something appears in
socket).

E.g. in following example you don't receive "123" lines until you send
something with 'telnet -z ssl localhost 5555':

%%% test_ssl.erl
-module(test_ssl).

-export([start/0, listen/0]).

start() ->
    ssl:start(),
    spawn(test_ssl, listen, []).

listen() ->
    {ok, ListenSocket} = ssl:listen(5555, [binary,
					   {packet, 0}, 
					   {active, false},
					   {nodelay, true},
					   {certfile, "./ssl.pem"}]),
    {ok, Socket} = ssl:accept(ListenSocket),
    timer:apply_interval(500, ssl, send, [Socket, "123\n"]),
    loop(Socket).

loop(Socket) ->
    case ssl:recv(Socket, 0) of
        {ok, Data} ->
	    loop(Socket)
    end.




More information about the erlang-questions mailing list