本文共 489 字,大约阅读时间需要 1 分钟。
名词解释:CHARGEN是在TCP连接建立后,服务器不断传送任意的字符到客户端,直到客户端关闭连接。
客户端:
recipes/tpc/netcat.cc. 每个线程一个连接 recipes/python/netcat.py io复用 recipes/python/netcat-nonblockpy io复用服务端:
recipes/tpc/chargen.cc recipes/python/chargen.py recipes/examples/simple/chargen/*测试指令:
1.客户端 nc localhost 1234 > /dev/null 注意:#/dev/null是指获取服务器上的数据不打印出来,丢掉 2. 服务端 ./chargen -l 1234 3. 打开终端,输入top查看cpu使用 测试如图:chargen in c++ | chargen in python | chargen in muduo | |
---|---|---|---|
nc | 1600 | ||
netcat.cc | 2800 | ||
nectar.py | 1000 | ||
netcat_nonblock | 1000 |
转载地址:http://dfhpn.baihongyu.com/