小编Sam*_*uel的帖子

测试扭曲的应用 - 加载客户端

我写过一个基于Twisted的服务器,我也想用扭曲测试它.

但我想写一个负载测试,同时启动一堆请求.

但我相信我没有得到Twisted的概念,主要是客户端,因为我遇到了这个问题:

    from twisted.internet import reactor, protocol
from threading import Thread
from twisted.protocols.basic import LineReceiver

__author__="smota"
__date__ ="$30/10/2009 17:17:50$"

class SquitterClient(LineReceiver):

    def connectionMade(self):
        self.sendLine("message from " % threading.current_thread().name);
        pass

    def connectionLost(self, reason):
        print "connection lost"

    def sendMessage(self, msg):
        for m in [ "a", "b", "c", "d", "e"]:
            self.sendLine(msg % " - " % m);

class SquitterClientFactory(protocol.ClientFactory):
    protocol = SquitterClient

    def clientConnectionFailed(self, connector, reason):
        print "Connection failed - goodbye!"
        reactor.stop()

    def clientConnectionLost(self, connector, reason):
        print "Connection lost - goodbye!"
        reactor.stop() …
Run Code Online (Sandbox Code Playgroud)

python multithreading twisted

3
推荐指数
1
解决办法
3438
查看次数

Javascript String nodejs流实现

我需要一个nodejs流(http://nodejs.org/api/stream.html)实现,它将数据发送到字符串.你认识的人吗?

为了直接,我正在尝试管理这样的请求响应:request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))

来自https://github.com/mikeal/request

谢谢

javascript node.js

3
推荐指数
2
解决办法
2219
查看次数

标签 统计

javascript ×1

multithreading ×1

node.js ×1

python ×1

twisted ×1