本文整理汇总了Python中multiprocessing.Process.send方法的典型用法代码示例。如果您正苦于以下问题:Python Process.send方法的具体用法?Python Process.send怎么用?Python Process.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.Process
的用法示例。
在下文中一共展示了Process.send方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import send [as 别名]
p = socket.socket()
try:
print "Connecting to " + prfc.hostname + ":" + str(prfc.port)
p.connect((prfc.hostname, int(prfc.port)))
except socket.error, v:
print "PEER ERROR: There was a socket error"
errorcode = v[0]
if errorcode == errno.ECONNREFUSED:
print "PEER ERROR: There is no peer on " + prfc.hostname + ":" \
+ str(prfc.port)
return
# Send GET to peer
try:
p.send("GET RFC " + str(prfc.rfc_num) + " " + VERSION + "\r\n" \
+ "Host: " + str(prfc.hostname) + "\r\n" + "OS: " + str(OS) \
+ "\r\n\r\n")
except IOError, e:
if e.errno == errno.EPIPE:
print "PEER ERROR: There is no peer on", prfc.hostname + ":" \
+ str(prfc.port)
p.close()
return
else:
print "PEER ERROR: There was an IOError", e.errno
# Receive response
response = str(p.recv(4096))
if DEBUG:
print "PEER FROM PEER: \n" + response,