New Socket module examples

Micael Karlberg micael.karlberg@REDACTED
Mon Jan 13 15:55:05 CET 2020


On 2019-12-23 16:51, Frank Muller wrote:
> Hi guys
> 
> I’m playing with the new socket module:
> https://erlang.org/doc/man/socket.html 
> <https://protect2.fireeye.com/v1/url?k=5a0c924e-06864758-5a0cd2d5-862f14a9365e-024cf25803d2a4fe&q=1&e=6b0ce9d7-7fc5-4cda-aa7e-e2bd5629c1de&u=https%3A%2F%2Ferlang.org%2Fdoc%2Fman%2Fsocket.html>
> 
> The idea is to switch my gen_tcp based Web server to socket.
> Currently, I’m using {active, N} and would like to know if anything equivalent is possible with socket?
> 
> Are there any examples I can look at?

Not exactly what you are asking for but:

https://erlang.org/pipermail/erlang-questions/2019-October/098655.html

> 
> Also, I read somewhere that in R23, gen_tcp will be based on the new socket module. Is this still true?

gen_tcp should *work* with the new 'socket' API. That is, if you specify that
you want to use the new 'socket', then a socket based on 'socket' will be created.
Something like:

	{ok, Sock} = gen_tcp:connect(Host, Port, [new|Opts]).

> 
> /Frank

Regards,
	/BMK



More information about the erlang-questions mailing list