本文整理汇总了Python中connector.Connector.recvData方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.recvData方法的具体用法?Python Connector.recvData怎么用?Python Connector.recvData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connector.Connector
的用法示例。
在下文中一共展示了Connector.recvData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Modem
# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import recvData [as 别名]
#.........这里部分代码省略.........
while (l or self.status != Modem.Status.KILL):
if l == "poweroff":
self.status = Modem.Status.KILL
l = f.read(self.conn.data_buf_size)
f.close()
except IOError:
print off_log + " not found"
try:
f = open (kill_log, "r")
l = f.read(self.conn.data_buf_size)
while (l or self.status != Modem.Status.KILL):
if (l == ("kill " + str(threadPID)) or \
l == ("kill " + str(self.mainPID))):
self.status = Modem.Status.KILL
l = f.read(self.conn.data_buf_size)
f.close()
except IOError:
print kill_log + " not found"
def kill(self):
"""
Status kill
@param self pointer to the class object
"""
self.status = Modem.Status.KILL
def close(self):
"""
Close the connection from the modem to the submerged node
@param self pointer to the class object
"""
self.conn.close()
def recvData(self):
"""
Receive the data as they are from the node, it is a blocking
function. To check if data has to be received, query the
self.conn.dataAvailable() function
@param self pointer to the class object
@return the incoming string from the TCP connection
"""
prec_state = self.status
self.status = Modem.Status.BUSY2RECV
data = self.conn.recvData()
self.status = prec_state
self.checkConnection(data)
return data
def recvCommand(self):
"""
Receive and process a command from the node
@param self pointer to the class object
@return the incoming string from the TCP connection
"""
prec_state = self.status
self.status = Modem.Status.BUSY2RECV
command = self.conn.recvCommand()
self.status = prec_state
self.checkConnection(command)
# self.parseCommand(command.rstrip('\n'))
self.parseDivCommands(command)
return command
def send(self, msg):
"""