Re: Pretending known chardata is an I/O device?

Сергей Прохоров <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAMZozm4PV7vsu4n0E7=qdzSpYDzK-KcW6BSw=ifB3UKtvK=Onw@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.