{active, N} in erlang secure tcp

I am writing this simple code using ssltcp:

ssl:start(). {ok, ListenSocket} = ssl:listen(9999, [{certfile, "cert.pem"}, {keyfile, "key.pem"},{reuseaddr, true}]). {ok, Socket} = ssl:transport_accept(ListenSocket). ssl:ssl_accept(Socket). ssl:setopts(Socket, [{active, once}]). 

it works fine, but when I replace {active, once} with {active, 3} , it returns this error:

{error, {options, {socket_options, {active, 3}}}}

How to use {active, N} mode in safe tcp?

+5
source share
1 answer

The {active,N} mode is not used for SSL connections. I originally wrote the {active,N} mode, and when I looked at maybe implementing it for SSL, I found that the way Erlang SSL sockets are implemented on top of TCP base sockets involves changing the sockets between active and passive modes as part, and therefore implementing {active,N} for SSL is not just opening a base socket in this mode.

+6
source

Source: https://habr.com/ru/post/1242476/


All Articles