ChatServer.py 文件源码

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

项目:HTP 作者: nklose 项目源码 文件源码
def run(self):
        while True:
            try:
                text = irc.recv(2040)
                if text.find('PING') != -1:
                    irc.send('PONG ' + text.split() [1] + '\r\n')
                    connected = True
                elif text.find('PRIVMSG') != -1:
                    end = text.find('!')
                    username = text[1:end]
                    start = text.find(channel + ' :')
                    message = text[start + len(channel) + 2:]
                    log('recv', '<' + username + '> ' + message)
                elif text.find('PART') != -1:
                    end = text.find('!')
                    username = text[1:end]
                    log('recv', '[' + username + '] left \n')
                elif text.find('JOIN') != -1:
                    end = text.find('!')
                    username = text[1:end]
                    log('recv', '[' + username + ']' + ' joined \n')
                else:
                    print(text)
            except socket.error:
                break
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号