Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PyZMQ:权限被拒绝_Python_Permissions_Pyzmq - Fatal编程技术网

Python PyZMQ:权限被拒绝

Python PyZMQ:权限被拒绝,python,permissions,pyzmq,Python,Permissions,Pyzmq,代码: 错误: import zmq from multiprocessing import Process import time def server(): port = '5556' context = zmq.Context() socket = context.socket(zmq.PAIR) socket.bind('tcp://*:%s' % port) for i in range(10): socket.send('s

代码:

错误:

import zmq
from multiprocessing import Process
import time

def server():
    port = '5556'
    context = zmq.Context()
    socket = context.socket(zmq.PAIR)
    socket.bind('tcp://*:%s' % port)

    for i in range(10):
        socket.send('server to client')
        msg = socket.recv()
        print msg
        time.sleep(1)

def client():
    port = '5556'
    context = zmq.Context()
    socket = context.socket(zmq.PAIR)
    socket.bind('tcp://127.0.0.1:%s' % port)

    for i in range(10):
        msg = socket.recv()
        print msg
        socket.send('msg to server')
        time.sleep(1)

if __name__ == '__main__':
    Process(target=server, args=()).start()
    Process(target=client, args=()).start() 
它能够为服务器启动进程1吗?为什么不同的许可


试图学习ZMQ,但无法获得任何简单的例子来运行这一原因。是否有地方可以打开ZMQ的权限?找不到有关此问题的文档

您只能在一侧(服务器)绑定。在客户端上,您必须使用
.connect
,尽管我得到的是“地址已在使用”错误,而不是权限被拒绝

尝试更改它,以便客户端连接并查看它是否适合您:

Process Process-2:
Traceback (most recent call last):
File "C:\Python27\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Python27\lib\multiprocessing\process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "C:\...\zmqtest.py", line 21, in client
socket.bind('tcp://127.0.0.1:%s' % port)
File "socket.pyx", line 444, in zmq.backend.cython.socket.Socket.bind (zmq\backend\cython\socket.c:4076)
File "checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc (zmq\backend\cython\socket.c:6032)
ZMQError: Permission denied

您只能在一侧(服务器)绑定
.bind
。在客户端上,您必须使用
.connect
,尽管我得到的是“地址已在使用”错误,而不是权限被拒绝

尝试更改它,以便客户端连接并查看它是否适合您:

Process Process-2:
Traceback (most recent call last):
File "C:\Python27\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Python27\lib\multiprocessing\process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "C:\...\zmqtest.py", line 21, in client
socket.bind('tcp://127.0.0.1:%s' % port)
File "socket.pyx", line 444, in zmq.backend.cython.socket.Socket.bind (zmq\backend\cython\socket.c:4076)
File "checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc (zmq\backend\cython\socket.c:6032)
ZMQError: Permission denied

您只能在一侧(服务器)绑定
.bind
。在客户端上,您必须使用
.connect
,尽管我得到的是“地址已在使用”错误,而不是权限被拒绝

尝试更改它,以便客户端连接并查看它是否适合您:

Process Process-2:
Traceback (most recent call last):
File "C:\Python27\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Python27\lib\multiprocessing\process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "C:\...\zmqtest.py", line 21, in client
socket.bind('tcp://127.0.0.1:%s' % port)
File "socket.pyx", line 444, in zmq.backend.cython.socket.Socket.bind (zmq\backend\cython\socket.c:4076)
File "checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc (zmq\backend\cython\socket.c:6032)
ZMQError: Permission denied

您只能在一侧(服务器)绑定
.bind
。在客户端上,您必须使用
.connect
,尽管我得到的是“地址已在使用”错误,而不是权限被拒绝

尝试更改它,以便客户端连接并查看它是否适合您:

Process Process-2:
Traceback (most recent call last):
File "C:\Python27\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Python27\lib\multiprocessing\process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "C:\...\zmqtest.py", line 21, in client
socket.bind('tcp://127.0.0.1:%s' % port)
File "socket.pyx", line 444, in zmq.backend.cython.socket.Socket.bind (zmq\backend\cython\socket.c:4076)
File "checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc (zmq\backend\cython\socket.c:6032)
ZMQError: Permission denied

服务器绑定可能是唯一的问题。您可以在windows防火墙中打开端口。服务器绑定可能是唯一的问题。您可以在windows防火墙中打开端口。服务器绑定可能是唯一的问题。您可以在windows防火墙中打开端口。服务器绑定可能是唯一的问题。您可以在windows防火墙中打开端口。非常感谢您对我犯下的这个明显错误有耐心。非常感谢您对我犯下的这个明显错误有耐心。非常感谢您对我犯下的这个明显错误有耐心。非常感谢您对我犯下的这个明显错误有耐心。