SN-10143 附来源、原文与上下文。
很好,那就不用考虑 d-bus 了。Windows 上有没有类似 IPC 套接字的东西?我想我们可以看看 wx 是怎么做的,也许 XML-RPC 库已经知道该怎么处理。Windows 有命名管道,也许那是最接近的对应物。
Good, then no need to consider d-bus. Is there something like IPC sockets on Windows? I guess we could look how wx does it, or maybe the XML-RPC library will already know what to do. Windows has named pipes, maybe that's the best analogue.
我想我不愿意发明自己的 RPC 协议,而是想用一个现有标准。PHP、Java、Python 或其他任何语言,都可以像命令行命令一样,直接与服务器通信。
I don't think I want to invent my own RPC protocol, I want to use an existing standard. PHP, Java, Python or anything will be able to talk to the server directly the same way the command line commands do.
我准备开始阅读 XML-RPC 的资料。搜索结果显示,它是使用最广泛、支持也很普遍的协议。PHP 的标准库里就包含它。
I'm going to start reading on XML-RPC. It's coming up in searches as the most widely used protocol and widely supported. PHP includes it in its standard libraries.
引用 Martti Malmi 的文字Martti Malmi来源 ↗引用中本聪此前的文字中本聪来源 ↗能否打开一个只能本地访问的套接字?
Is it possible to open a socket that can only be accessed locally?
可以,IPC 套接字(“Unix domain sockets”)就只能在本地使用。在 wx-api 中,用文件名代替端口号就能做到。我提交了一个 wxServer-Client 通信用法的示例,你愿意的话可以撤销。现在有一个 -blockamount 命令行选项,会向运行中的实例询问区块链长度。
Yes, you can use IPC sockets ("Unix domain sockets") which are local only. That's done in the wx-api by using a filename in place of a port number. I committed an example of how the wxServer-Client communication is used, you can revert if you want to. Now there's the -blockamount command line option which asks the running instance for the block chain length.
我认为这种命令行方式已经可以从 PHP 调用,但如果 php 自己能直接调用套接字服务器,可能会更轻量。 wx 的 IPC 概述提到 wxSocketEvent、wxSocketBase、 wxSocketClient 和 wxSocketServer 是“底层 TCP/IP API 的类”,从 php 使用它们,可能比我现在用的(wxServer、wxClient、wxConnection)更容易。我会进一步研究。
I think this command line method could already be used from PHP, but it might be lighter if php itself could call the socket server directly. The wx's IPC overview mentions wxSocketEvent, wxSocketBase, wxSocketClient and wxSocketServer as being "Classes for the low-level TCP/IP API", which might be easier to use from php than what I used now (wxServer, wxClient, wxConnection). I'll look more into it.