[erlang-questions] OTP 22 socket module

Andreas Schultz andreas.schultz@REDACTED
Tue Oct 29 08:50:22 CET 2019


Hi Pablo,

For demonstrating a problem I've recently written a small escript [1] that
does asynchronous UDP with the socket module.
I've also converted a fairly complex application with two different UDP
socket endpoints from our own implementation to the socket module [2].

For asynchronous receive you need OTP 22.1 and you definitely want an
OTP version that has PR #2434 applied [3].

Regards,
Andreas

[1] https://gist.github.com/RoadRunnr/311a7679fff6fbdf367c455b960f1ba8
[2]
https://github.com/travelping/ergw/commit/df61b18362277129d946160439301b5c5df9fcf1
[3] https://github.com/erlang/otp/pull/2434

Am Mo., 28. Okt. 2019 um 20:30 Uhr schrieb pablo platt <
pablo.platt@REDACTED>:

> Andreas, do you have a wrapper module or some code you can share?
> I'm trying to replace a gen_udp server with the socket module.
>
> On Fri, Mar 29, 2019 at 7:18 PM Ingela Andin <ingela.andin@REDACTED>
> wrote:
>
>> Hi!
>>
>> Den ons 27 mars 2019 kl 08:20 skrev Andreas Schultz <
>> andreas.schultz@REDACTED>:
>>
>>> Hi,
>>>
>>> Is a {active, N} like delivery of data planed for the new socket or will
>>> polling the recv methods be the only way the receive data? What about
>>> non-blocking connect and accept?
>>>
>>>
>> It is planned to have behaviours that implement the active behaviour  but
>> not as part of the socket module. The socket module should be the
>> primitives.
>>
>>
>>
>>> My preference would be to get an active notification when data is
>>> available for receive and another one when when a non-blocking write is
>>> possible. Sending and reception should then be left to the caller.
>>> Same goes for non-block accept and connect. Call accept/connect with a
>>> async option and get some message when the procedures finishes.
>>>
>>> I do realize that all this could be build with a gen_server/gen_statem
>>> around socket, so I guess the real question is does it make sense to start
>>> build such a wrapper or are the plans to make async functions part of the
>>> socket module?
>>>
>>>
>> Maybe Michael will have some more comments.
>>
>>
>>
>>> Thanks
>>> Andreas
>>> --
>>> --
>>> Dipl.-Inform. Andreas Schultz
>>>
>>> ----------------------- enabling your networks ----------------------
>>> Travelping GmbH                     Phone:  +49-391-81 90 99 0
>>> Roentgenstr. 13                     Fax:    +49-391-81 90 99 299
>>> 39108 Magdeburg                     Email:  info@REDACTED
>>> GERMANY                             Web:    http://www.travelping.com
>>>
>>> Company Registration: Amtsgericht Stendal        Reg No.:   HRB 10578
>>> Geschaeftsfuehrer: Holger Winkelmann          VAT ID No.: DE236673780
>>> ---------------------------------------------------------------------
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>

-- 

Andreas Schultz

-- 

Principal Engineer

t: +49 391 819099-224

------------------------------- enabling your networks
-----------------------------

Travelping GmbH

Roentgenstraße 13

39108 Magdeburg

Germany

t: +49 391 819099-0

f: +49 391 819099-299

e: info@REDACTED

w: https://www.travelping.com/

Company registration: Amtsgericht Stendal  Reg. No.: HRB 10578
Geschaeftsfuehrer: Holger Winkelmann VAT ID: DE236673780
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191029/19cd339f/attachment.htm>


More information about the erlang-questions mailing list