当前位置: 首页>>代码示例>>Python>>正文


Python Event.getCurrentMills方法代码示例

本文整理汇总了Python中Event.getCurrentMills方法的典型用法代码示例。如果您正苦于以下问题:Python Event.getCurrentMills方法的具体用法?Python Event.getCurrentMills怎么用?Python Event.getCurrentMills使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event.getCurrentMills方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: receiveHandler

# 需要导入模块: import Event [as 别名]
# 或者: from Event import getCurrentMills [as 别名]
 def receiveHandler(self, rudpSocket, senderAddress, data):
     packet = VsPacket().unpack(data)
     print ">> " + str(packet)
     
     ''' Get or create file info object'''
     fileInfo = None
     for fInfoTmp in self.files:
         if fInfoTmp.sender == senderAddress:
             fileInfo = fInfoTmp
     if fileInfo is None:
         fileInfo = FileInfo()
         fileInfo.sender = senderAddress
         self.files.append(fileInfo)
     
     ''' Handle different VSFTP pacekt types'''
     if packet.type == VsPacket.TYPE_BEGIN:
         if fileInfo.filename is not None:
             print "File already open !!!!"
             sys.exit(1)
         
         filename = packet.data
         print "GOT PACKET BEGIN, openning fileToWrite for writing:" + filename
         fileInfo.filename = filename
         fileInfo.filehandle = open(filename,'w')
         fileInfo.sendStarted = Event.getCurrentMills()  
         pass
     elif packet.type == VsPacket.TYPE_DATA:
         fileInfo.filehandle.write(packet.data)
         pass
     elif packet.type == VsPacket.TYPE_END:
         print "GOT PACKET END, closing file"
         fileInfo.filehandle.close()
         self.files.remove(fileInfo)
         print "Socket closed event received on " + str(rudpSocket)
         print "Lost Packets:" + str(rudpSocket.packetloss)
         print "Sent Data packets:" + str(rudpSocket.packetsSentData)
         print "Sent Control packets:" + str(rudpSocket.packetsSentControl)
         print "Received packets(total):" + str(rudpSocket.packetsReceived)
         print "Received data packets:" + str(rudpSocket.packetsReceivedData)
         print "Received and skipped packets:" + str(rudpSocket.packetsReceivedIgnored)
         print "Fake loss:" + str(rudpSocket.packetFakeLoss)
         print "Time taken: " + str((Event.getCurrentMills() - fileInfo.sendStarted))
 
         pass  
     pass
开发者ID:El--Presidente,项目名称:python-rudp,代码行数:47,代码来源:RudpReceiver.py

示例2: handleEvent

# 需要导入模块: import Event [as 别名]
# 或者: from Event import getCurrentMills [as 别名]
 def handleEvent(self, rudpSocket, eventType):
     if eventType == Event.TYPE_TIMEOUT:
         sys.exit("TimeOut event received")
     if eventType == Event.TYPE_CLOSED:
         print "Socket closed event received on " + str(rudpSocket)
         print "Lost Packets:" + str(rudpSocket.packetloss)
         print "Sent Data packets:" + str(rudpSocket.packetsSentData)
         print "Sent Control packets:" + str(rudpSocket.packetsSentControl)           
         print "Received packets(total):" + str(rudpSocket.packetsReceived)
         print "Received data packets:" + str(rudpSocket.packetsReceivedData)
         print "Received and skipped packets:" + str(rudpSocket.packetsReceivedIgnored)
         print "Fake loss:" + str(rudpSocket.packetFakeLoss)
         print "Time taken: " + str((Event.getCurrentMills() - self.timeStarted))
开发者ID:El--Presidente,项目名称:python-rudp,代码行数:15,代码来源:RudpSender.py


注:本文中的Event.getCurrentMills方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。