我正在使用zeromq构建REQ/REP服务,REP部分在Scala中并使用Akka actor.
这是演员
class ReplyActor extends Actor {
println("Listening..")
def receive = {
case m: ZMQMessage =>
sender ! ZMQMessage(Seq(Frame("world")))
case _ =>
sender ! ZMQMessage(Seq(Frame("didn't understand?")))
}
}
Run Code Online (Sandbox Code Playgroud)
而我的主要功能
object Replyer extends App {
val system = ActorSystem("zmq")
val serverSocket = ZeroMQExtension(system).newRepSocket(
Array(
Bind("tcp://127.0.0.1:1234"),
Listener(system.actorOf(Props[ReplyActor]))
)
)
}
Run Code Online (Sandbox Code Playgroud)
我的REQ代码是在python中
import zmq
import time
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://127.0.0.1:1234")
startTime = time.time()
for i in range(10):
msg = "msg %s" % i
socket.send("hello")
msg_in = socket.recv()
print 'That …Run Code Online (Sandbox Code Playgroud) 我的问题是我无法在远程服务器上包含文件。
<?php
echo "Including\n";
require_once("http://xx.xxx.xxx.xx:8080/path/to/myfile.inc");
echo "Done..\n";
?>
Run Code Online (Sandbox Code Playgroud)
该脚本在 require_once 函数处失败。我正在运行脚本: php -d allowed_url_include=On script.php 但要确保我已在 php.ini 中将allow_url_include 和allow_url_fopen 设置为On
如果我将http://xx.xxx.xxx.xx:8080/path/to/myfile.inc复制到浏览器,我就会收到该文件。我也尝试过包含其他远程文件(在标准端口 80 上),但仍然没有成功
我真正感到困惑的是,一切都可以在我办公室的本地计算机(mac、ubuntu)上运行,但不能在我们的服务器上运行。我已经在两台不同的服务器(虚拟服务器和专用服务器)上对其进行了测试。我可以使用 fopen() 获取该文件。