博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
twisted: echo server
阅读量:6924 次
发布时间:2019-06-27

本文共 337 字,大约阅读时间需要 1 分钟。

from twisted.internet import protocol, reactor

class Echo(protocol.Protocol):
    def dataReceived(self, data):
        self.transport.write(data)
class EchoFactory(protocol.Factory):
    def buildProtocol(self, addr):
        return Echo()
reactor.listenTCP(1234, EchoFactory())
reactor.run()

 

run server:

python testTwisted.py

 

run client:

telnet localhost 1234

转载地址:http://zzecl.baihongyu.com/

你可能感兴趣的文章
『中级篇』Dockerfile实战(19)
查看>>
配置linux IP
查看>>
lnmp安装---源码安装mysql5.6 -- nginx -- php -- memached
查看>>
实时同步inotify+rsync的简单部署
查看>>
MogileFS
查看>>
两个java客户端程序
查看>>
数据结构和算法分析之线性表
查看>>
理解volatile
查看>>
zabbix管理与使用
查看>>
给UILabel添加边框和圆角
查看>>
通过selenium模拟键盘输入链接整理
查看>>
iOS 登录页面设计
查看>>
特殊权限set_uid set_gid stick_bit 软/硬链接文件
查看>>
企业分布式SpringCloud+SpringBoot+Mybatis+shiro+微服务 技术分享
查看>>
hibernate 查询条件 对象expression
查看>>
分布式事务
查看>>
Linux就该这么学 - 第四课 - 打包压缩~第3章重定向与环境变量
查看>>
简单的单臂路由的 配置实验(华为)
查看>>
技术和商业的碰撞,谈阿里云与天猫双11这十年
查看>>
智能家居应该怎样来维护和保养—成都首脑智能家居项目
查看>>