Pretending known chardata is an I/O device?
Сергей Прохоров
seriy.pr@REDACTED
Wed Jan 13 14:37:57 CET 2021
Hi, Yestin,
I recently implemented (write-only) IO-server in epgsql:
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
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/e96ce4a4/attachment.htm>
More information about the erlang-questions
mailing list