Pretending known chardata is an I/O device?

bengt cean.ebengt@REDACTED
Wed Jan 13 22:10:24 CET 2021


Greetings,

You might want to start from
https://github.com/ebengt/erlang_string_io

Only for a string.

Best Wishes,
bengt

> On 13 Jan 2021, at 14:37, Сергей Прохоров <seriy.pr@REDACTED> wrote:
> 
> Hi, Yestin,
> 
> I recently implemented (write-only) IO-server in epgsql:
> 
> https://github.com/epgsql/epgsql/pull/248/files#diff-bee3ee44dca8eaa3ab72727b8d11c695f2ae4dcf0a0534fc51323d0aaa1a3a9fR523-R550 <https://github.com/epgsql/epgsql/pull/248/files#diff-bee3ee44dca8eaa3ab72727b8d11c695f2ae4dcf0a0534fc51323d0aaa1a3a9fR523-R550>
> 
> I'd say it's quite easy task to do, the protocol itself is very compact and well documented and it has a complete example:
> 
> https://erlang.org/doc/apps/stdlib/io_protocol.html <https://erlang.org/doc/apps/stdlib/io_protocol.html>
> 
> I think starting normal gen_server that takes your data string in `init/1` or maybe receives it in a separate call would work fine. And you'd need to handle `{io_request, ..}` messages in `handle_info` gen_server callback.
> 
> Regards,
> Sergey

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210113/ea0f3672/attachment.htm>


More information about the erlang-questions mailing list