def startServer(self, componentType, cid, gus, targetIP, trycount = 1, timeout = 1):
"""
"""
msg = Define.BytesIO()
msg.write( struct.pack("=H", MachineInterface_startserver ) ) # command
msg.write( struct.pack("=H", struct.calcsize("=iiQhH") ) ) # command length
msg.write( struct.pack("=i", self.uid) )
msg.write( struct.pack("=i", componentType) )
msg.write( struct.pack("=Q", cid) )
msg.write( struct.pack("=h", gus) )
msg.write( struct.pack("=H", socket.htons(self.replyPort)) ) # reply port
if trycount <= 0:
self.send( msg.getvalue(), targetIP )
self.receiveReply()
else:
self.sendAndReceive( msg.getvalue(), targetIP, trycount, timeout )
评论列表
文章目录