__init__.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:dubbo-telnet-py 作者: WALL-E 项目源码 文件源码
def do(self, command):
        # ??Telnet???
        try:
            tn = telnetlib.Telnet(host=self.host, port=self.port, timeout=self.__connect_timeout)
        except socket.error as err:
            print("[host:%s port:%s] %s" % (self.host, self.port, err))
            return

        # ??doubble???
        tn.write('\n')

        # ????
        tn.read_until(self.__finish, timeout=self.__read_timeout)
        tn.write('%s\n' % command)

        # ????
        data = ''
        while data.find(self.__finish) == -1:
            data = tn.read_very_eager()
        data = data.split("\n")
        data = json.loads(data[0], encoding=self.__encoding)

        tn.close()  # tn.write('exit\n')

        return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号