问题标签 [twisted.internet]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 文本未在 Twisted 中发送
我正在关注有关客户端/服务器的官方 Twisted示例。我正在使用LineReceiver.sendLine()将文本从客户端发送到服务器。此代码有效:
我可以在我的服务器端看到它。但是如果我添加这样的东西:
我可以看到“正在发送... ”和“已发送”,但仅此而已。即使客户端似乎正在发送数据,服务器也没有收到任何信息。如果我输入“断开连接”,所有内容都会立即发送,包括“你好,世界!'
因此我的问题是:实际发送发生在哪里?以及如何实现上述目标?
python - 如何运行 Twisted Matrix Web 服务器
我想运行作为开源项目JInfinote一部分的演示。演示服务器是使用 Twisted Matrix 库/服务器编写的。但是我不知道如何运行它,如果它是我需要下载才能运行的独立服务器,还是它只是 python 或库以及如何配置整个东西。
当我尝试在 python 中运行它时,我得到了一些会话异常——就好像它试图逐个函数地执行代码函数一样。我将不胜感激。
我对这个问题的水平感到抱歉,但我不是 python 程序员,我只是想了解 JInfinote 项目,这是一个障碍。
python - 在 Windows 中运行 python 脚本..?ImportError:没有名为“扭曲”的模块
我是 python 新手。这是我的问题。我已经安装了 python 3.2 并且我的应用程序运行良好。我在 python 中做一个客户端服务器套接字 tcp 监听代码。当我尝试在 python shell 中运行代码时,它会抛出错误,说“ twisted ” ImportError: No module named 'twisted'。由于我使用的是 python 3.2。我读到了一些扭曲库提供最新版本的地方。
我想我正在做的是赖特。或者如果我必须从其他地方安装twisted或安装较低版本的python......?
python - Refactoring for a twisted tcp client from existing blocking code
I have a python program that currently uses a tcp/ip client module I wrote to receive data from a streaming server. The server outputs lines of data.
My TCP client class is fairly primitive and I want to refactor to use a twisted ReconnectingClientFactory.
The main program currently gets data from a readLines function in my TCP Client that 'yields' the lines as they are received.
The TCP client method is accessed by:
In my TCP Client the readLines method in essence looks like:
When I implement the twisted client I'll want some way for it to behave as an iterator and yield data. I assume I'd do something in the protocol dataReceived method.
I'm lost trying to figure out how this works. It appears to me that twisted deferred are meant for this sort of use but I can't figure out how to use a deferred for my purpose (if my assumption about deferred is correct).
In a perfect world the twisted client would yield the lines as received so a call similar to the present method would do the job. i.e.
But I think that's an oversimplification.
In summary, what I'm trying to do is implement a twisted reconnecting TCP client that behaves something like my readLines method and can be accessed more or less like:
Any pointers will be much appreciated
UPDATE: I just stumbled across 'Crochet' for twisted. At first glance Crochet appears to have been designed for exactly the kind of model that I need... I'll report back after some testing
twisted - Twisted ReconnectingClientFactory - 自动重新连接或显式调用connector.connect()?
当使用 Twisted ReconnectingClientFactory 并且连接丢失时,我需要从 clientConnectionLost 方法中调用 connector.connect() 还是自动发生这种情况?
答案可能看起来很明显,因为它毕竟是 ReconnectingClientFactory但 Twisted 文档在这里说了一些让我想知道的东西:
“调用 connector.connect() 可能很有用 - 这将重新连接。”
术语“可能有用”的措辞和使用导致了这个问题,因为基本客户端工厂的 api 文档说了同样的话。
Max的答案是正确的,但经过进一步研究,我认为“校正者”的答案如下:
这允许您执行应用程序所需的特殊操作,然后调用工厂代码以允许 Twisted 为您调用 retry()。
python-2.7 - 学习 Twisted 框架并遇到手指服务器问题
我正在使用 Twisted Documentation Finger 教程 ( http://twistedmatrix.com/documents/current/core/howto/tutorial/intro.html ) 为我正在从事的项目学习 Twisted 框架,但我无法获得我的程序工作。
这是服务器的代码,它应该在我返回“没有这样的用户”时telnet localhost 12345
,但它只是停留在那里,没有发生任何事情。
我已经通过python twisted-finger.py
and运行了服务器sudo python twisted-finger.py
,但都没有工作。
有谁知道为什么这不会返回它应该返回的消息?
sockets - Twisted reactor.listenTCP 间歇性无法正常连接
我正在使用 reactor.listenTCP 在 linux 上运行 TCP 服务器。
几个小时(或几天)一切正常,然后发生了一些事情,客户端可以连接,但它们立即被服务器断开连接。
我的协议实现中没有任何命令断开连接。客户端实现中没有任何东西会导致这种断开连接。
服务器使用 sendLine(data) 间歇性地向它在用户列表中找到的所有用户发送一些数据。
我想知道当我错过的客户端断开连接时我是否打算执行一些操作,这会导致套接字问题。
---> mainLoop 类的其他地方是定期运行的代码:
twisted - 服务之间如何通信?
我有两台服务器:
现在如何将从 service_1 接收到的数据发送到 service_2?service_2 仅作为从 service_1 接收的数据的回显服务器
twisted - Twisted - LineReceiver sendLine 的成功(或失败)回调
在完成使用它的应用程序的过程中,我仍在尝试掌握 Twisted。
我的问题是:
我的应用程序使用 LineReceiver.sendLine 从 Twisted TCP 服务器发送消息。我想知道 sendLine 是否成功。
我收集到我需要以某种方式向 sendLine 添加成功(和错误?)回调,但我不知道该怎么做。
感谢任何指针/示例
python - 使用scrapy框架进行抓取时出现扭曲的互联网错误ConnectionLost
我正在尝试从某些网站上抓取数据。但过了一会儿,网络爬虫开始给出扭曲的互联网错误 ConnectionLost 错误。我不明白扭曲的工作。此外,由于这个错误,网络爬虫会持续运行很长时间。不知道是什么导致他们工作缓慢。请提出一些理由。我的互联网连接很好。
以下是错误:
谢谢您的帮助