Discussion:
erlang text://protocol server?
Petite Abeille
2021-04-09 15:05:48 UTC
Permalink
Hello,

Would you know of any erlang text://protocol servers? Or clients?

Thanks in advance.

[1] https://textprotocol.org
[2] https://github.com/textprotocol/public
[3] https://github.com/textprotocol/publictext
Kenneth Lakin
2021-04-09 16:02:32 UTC
Permalink
Post by Petite Abeille
Would you know of any erlang text://protocol servers? Or clients?
I don't know of any, but how would you even implement one? Maybe I'm
getting too old for this, but I don't see any coherent protocol
documentation at any of the sites you mentioned in your footnotes.
Petite Abeille
2021-04-09 18:29:43 UTC
Permalink
Post by Kenneth Lakin
I don't know of any, but how would you even implement one?
At first glance, the Lua server is around ~113 sloc:

https://github.com/textprotocol/publictext/blob/main/publictext

±0¢
Jesper Louis Andersen
2021-04-09 19:16:23 UTC
Permalink
Post by Petite Abeille
https://github.com/textprotocol/publictext/blob/main/publictext
I think you could get going with ninenines/ranch to get an acceptor pool
going. Then implementing the lua code should be pretty straightforward.
This looks like a really fun small beginner project that has a tangible
output.
--
J.
Petite Abeille
2021-04-09 19:25:59 UTC
Permalink
I think you could get going with ninenines/ranch to get an acceptor pool going.
That one?

https://github.com/ninenines/ranch

That would be in-lieu of djb's tcpserver, right?

https://cr.yp.to/ucspi-tcp/tcpserver.html
Then implementing the lua code should be pretty straightforward. This looks like a really fun small beginner project that has a tangible output.
Fun indeed.

Thanks.
Jesper Louis Andersen
2021-04-09 19:57:32 UTC
Permalink
Post by Petite Abeille
That one?
https://github.com/ninenines/ranch
That would be in-lieu of djb's tcpserver, right?
https://cr.yp.to/ucspi-tcp/tcpserver.html
Then implementing the lua code should be pretty straightforward. This
looks like a really fun small beginner project that has a tangible output.
Fun indeed.
Yes to both!

There's a couple of things one has to do w.r.t asking the socket for
information rather than relying on that being set in the os environment,
etc. But you should have a fairly straightforward time, especially if you
take the same approach the lua code is taking. Just exploit the heck out of
pattern matching, and you can fold most of the asserts and substring checks
into them. Look up binary pattern matching as well.

And if something doesn't match, just crash the server. You can always do
the error handling later if need be.
--
J.
Petite Abeille
2021-04-09 20:34:12 UTC
Permalink
Post by Jesper Louis Andersen
Yes to both!
There's a couple of things one has to do w.r.t asking the socket for information rather than relying on that being set in the os environment, etc. But you should have a fairly straightforward time, especially if you take the same approach the lua code is taking. Just exploit the heck out of pattern matching, and you can fold most of the asserts and substring checks into them. Look up binary pattern matching as well.
And if something doesn't match, just crash the server. You can always do the error handling later if need be.
Fantastic. Thanks for the guidance.

QQ: Ranch mentions transport interfaces — namely TCP & TLS. [1]

How would something like QUIC fit in the picture?

[1] https://ninenines.eu/docs/en/ranch/2.0/guide/transports/
Loïc Hoguin
2021-04-09 21:03:42 UTC
Permalink
Post by Petite Abeille
Post by Jesper Louis Andersen
Yes to both!
There's a couple of things one has to do w.r.t asking the socket for information rather than relying on that being set in the os environment, etc. But you should have a fairly straightforward time, especially if you take the same approach the lua code is taking. Just exploit the heck out of pattern matching, and you can fold most of the asserts and substring checks into them. Look up binary pattern matching as well.
And if something doesn't match, just crash the server. You can always do the error handling later if need be.
Fantastic. Thanks for the guidance.
QQ: Ranch mentions transport interfaces — namely TCP & TLS. [1]
How would something like QUIC fit in the picture?
It wouldn't fit because it doesn't work the same. While QUIC does have a
concept of connections, it doesn't have the same ordering requirements
and streams make a simple "recv" no longer possible. QUIC will need its
own interface.

That's fine though, projects can use both Ranch and QUIC separately if
needed.

Cheers,
--
Loïc Hoguin
https://ninenines.eu
Continue reading on narkive:
Loading...