有没有办法在Perl 6中处理Unix套接字? [英] Is there a way to deal with Unix sockets in Perl 6?

查看:94
本文介绍了有没有办法在Perl 6中处理Unix套接字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Unix套接字与 mpv 进行通信,但Perl  6不提供任何高级别这样做的界面。所以我想我可以为此编写一个小模块,开始深入挖掘,找到了 IO :: Socket :: INET 的实现,并了解了NQP操作 nqp :: socket nqp :: connect

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.

但是,我在 NQP运营清单中找不到任何提及,它们似乎与传统的BSD套接字API截然不同。因此,我想问一下:那两个能够创建一个Unix套接字并连接到它吗?如果是这样,怎么样?或者是否有另一种方式?

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?

推荐答案

我认为现在最好的方法是使用NativeCall接口来调用C级别功能。有一些旧的设计文档表明IO :: Socket :: UNIX被认为是。但它还没有成为当前版本的语言规范(还)。

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).

这篇关于有没有办法在Perl 6中处理Unix套接字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆