本文整理汇总了Python中Event.eventFd方法的典型用法代码示例。如果您正苦于以下问题:Python Event.eventFd方法的具体用法?Python Event.eventFd怎么用?Python Event.eventFd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event.eventFd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createSocket
# 需要导入模块: import Event [as 别名]
# 或者: from Event import eventFd [as 别名]
def createSocket(addr, port):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((addr, port))
rudpSocket = RudpSocket(sock)
rudpSocket.addr_src = sock.getsockname()
rudpSockets.append(rudpSocket)
Event.eventFd(sock.fileno(), handleDataAvailable, rudpSocket, "DataReceived")
return rudpSocket
示例2: send
# 需要导入模块: import Event [as 别名]
# 或者: from Event import eventFd [as 别名]
def send(self):
self.rudpSocket = Rudp.createSocket(UDP_IP, UDP_PORT)
Rudp.registerEventHandler(self.rudpSocket, fileSender.handleEvent)
for desination in self.addresses:
self.rudpSocket.addPeer(desination)
fileToSend = open(self.fileName)
Event.eventFd(fileToSend.fileno(), self.handleFileDataAvailable, fileToSend, "FileDataAvailable")
print "Openned fileToSend DF:" + str(fileToSend.fileno()) + " name: " + str(self.fileName)
''' Send BEGIN packet'''
vsFtpPacket = VsPacket()
vsFtpPacket.type = VsPacket.TYPE_BEGIN
vsFtpPacket.data = FileSender.processFileName(self.fileName)
if self.rudpSocket.sendToAll(vsFtpPacket.pack()) == False:
print "Transmission error, quiting"
sys.exit()