Is there a way to deal with Unix sockets in Perl 6?

天大地大妈咪最大 提交于 2019-12-08 16:47:35

问题


I'd like to communicate with mpv using Unix sockets, but Perl 6 doesn't offer any high level interface for doing that. So I thought I could write a little module for that, started digging deeper, found the implementation of IO::Socket::INET, and learned about the NQP ops nqp::socket and nqp::connect.

However, I couldn't find any mention of those in the NQP operations list, and they seem to be quite distinct from the traditional BSD socket API. Hence I'd like to ask: are those two able to create a Unix socket and connect to it? If so, how? Or is there perhaps another way?


回答1:


I think the best way right now is to use the NativeCall interface to call the C level functions. There are some old design documentation that suggest an IO::Socket::UNIX was thought about. But it's not made it into contemporary releases of the language specification (yet).



来源:https://stackoverflow.com/questions/46221935/is-there-a-way-to-deal-with-unix-sockets-in-perl-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!