本文整理匯總了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()