本文整理汇总了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
示例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))