當前位置: 首頁>>代碼示例>>Python>>正文


Python Event.eventTimeout方法代碼示例

本文整理匯總了Python中Event.eventTimeout方法的典型用法代碼示例。如果您正苦於以下問題:Python Event.eventTimeout方法的具體用法?Python Event.eventTimeout怎麽用?Python Event.eventTimeout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Event的用法示例。


在下文中一共展示了Event.eventTimeout方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __emptyBuffer

# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeout [as 別名]
 def __emptyBuffer(self):
     logger.log(Level.TRACE, "Sending packets, window:" +  str(self.window) + " index:" + str(self.nextSendingPacketSeqNumber))
     if len(self.dataBuffer) > self.nextSendingPacketSeqNumber:
         while self.window > 0 and len(self.dataBuffer) > 0 and len(self.dataBuffer) > self.nextSendingPacketSeqNumber:            
             packet = self.dataBuffer[self.nextSendingPacketSeqNumber]
             self.rudpSocket.sendPacketData(self.addr, packet)
             self.nextSendingPacketSeqNumber = self.nextSendingPacketSeqNumber + 1
             self.window = self.window - 1
             Event.eventTimeout(RudpSocket.PARAM_TIMEOUT, self.__handleTimeoutData, packet.seqnum, "DATA Timeout")
開發者ID:El--Presidente,項目名稱:python-rudp,代碼行數:11,代碼來源:Rudp.py

示例2: __handleTimeoutSYN

# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeout [as 別名]
 def __handleTimeoutSYN(self, packetSequenceNumber):
     logger.log(Level.DEBUG, "Handling SYN timeout of:" + str(packetSequenceNumber))
     Event.eventTimeoutDelete(self.__handleTimeoutSYN, packetSequenceNumber)
     if self.__incrementRetries():
         packet = self.rudpSocket.generateSynPacket()
         self.nextAckSeqNumber = packet.seqnum + 1
         logger.log(Level.INFO, "Retransmitting SYN")
         self.rudpSocket.sendPacketControl(self.addr, packet)
         Event.eventTimeout(RudpSocket.PARAM_TIMEOUT, self.__handleTimeoutSYN, packet.seqnum, "SYN timeout")
開發者ID:El--Presidente,項目名稱:python-rudp,代碼行數:11,代碼來源:Rudp.py

示例3: __handleTimeoutFIN

# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeout [as 別名]
 def __handleTimeoutFIN(self, packetSequenceNumber):
     logger.log(Level.DEBUG, "Handling FIN timeout of:" + str(packetSequenceNumber))
     if self.__incrementRetries():
         Event.eventTimeoutDelete(self.__handleTimeoutFIN, packetSequenceNumber)
         packet = RudpPacket()
         packet.type = RudpPacket.TYPE_FIN
         packet.seqnum = packetSequenceNumber
         self.rudpSocket.sendPacketControl(self.addr, packet)
         Event.eventTimeout(RudpSocket.PARAM_TIMEOUT, self.__handleTimeoutFIN, packet.seqnum, "DATA Timeout")    
開發者ID:El--Presidente,項目名稱:python-rudp,代碼行數:11,代碼來源:Rudp.py

示例4: __checkClose

# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeout [as 別名]
 def __checkClose(self):
     ''' Send FIN if all packet have been sent - last packet in a buffer was sent and all have been ACK'ed'''
     if self.closePending is True:
         logger.log(Level.DEBUG, str(self.nextBufferPacketSeqNumber) + ">" + str(self.nextSendingPacketSeqNumber) + " >" + str(self.nextAckSeqNumber))
         if  self.nextBufferPacketSeqNumber == self.nextSendingPacketSeqNumber == (self.nextAckSeqNumber - 1):
             logger.log(Level.DEBUG, "Closing peer socket:" + str(self))
             packet = RudpPacket()
             packet.type = RudpPacket.TYPE_FIN
             packet.seqnum = self.dataBuffer[self.nextSendingPacketSeqNumber - 1].seqnum + 1
             self.rudpSocket.sendPacketControl(self.addr, packet)
             Event.eventTimeout(RudpSocket.PARAM_TIMEOUT, self.__handleTimeoutFIN, packet.seqnum, "DATA Timeout")
             self.state = RudpSocket.STATE_CLOSED                
         else:
             logger.log(Level.DEBUG, "Could not close peer socket yet !!!!")
開發者ID:El--Presidente,項目名稱:python-rudp,代碼行數:16,代碼來源:Rudp.py

示例5: sendToAll

# 需要導入模塊: import Event [as 別名]
# 或者: from Event import eventTimeout [as 別名]
 def sendToAll(self, data):        
     if self.state == RudpSocket.STATE_LISTEN:
         print str(self) + " not ESTABLISHED, sending SYN"
         packet = self.rudpSocket.generateSynPacket()
         self.nextAckSeqNumber = packet.seqnum  + 1
         self.rudpSocket.sendPacketControl(self.addr, packet)
         self.state = RudpSocket.STATE_INITING
         Event.eventTimeout(RudpSocket.PARAM_TIMEOUT, self.__handleTimeoutSYN, packet.seqnum, "SYN timeout")
     elif self.state == RudpSocket.STATE_INITING:
         logger.log(Level.DEBUG, str(self) + " STATE_INITING, adding data to buffer")    
     elif self.state == RudpSocket.STATE_ESTABLISHED:
         logger.log(Level.DEBUG, str(self) + " STATE_ESTABLISHED, adding data to buffer")   
     elif self.state == RudpSocket.STATE_CLOSED:
         logger.log(Level.ERROR, str(self) + " STATE_CLOSED, adding data to buffer")   
         return False
     # Build packet and add to buffer
     packet = RudpPacket()
     packet.type = RudpPacket.TYPE_DATA
     packet.data = data
     packet.seqnum = self.nextBufferPacketSeqNumber        
     self.dataBuffer.append(packet)
     self.nextBufferPacketSeqNumber = self.nextBufferPacketSeqNumber + 1
     logger.log(Level.TRACE, "Buffer has packets:" + str(len(self.dataBuffer)))
     return True
開發者ID:El--Presidente,項目名稱:python-rudp,代碼行數:26,代碼來源:Rudp.py


注:本文中的Event.eventTimeout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。