Questions tagged [twisted.internet]

Twisted Internet: Asynchronous I/O and Events.

Twisted Internet is a collection of compatible event-loops for . It contains the code to dispatch events to interested observers and a portable API so that observers need not care about which event loop is running. Thus, it is possible to use the same code for different loops, from Twisted's basic, yet portable, select-based loop to the loops of various GUI toolkits like GTK+ or Tk.

Project and documentation: http://twistedmatrix.com/documents/current/api/twisted.internet.html

180 questions
1
vote
1 answer

does pauseProducing() in Twisted guarantee no more calls to dataReceived()?

This is an extension of my question here: python twisted: enforcing a single connection per id I'm trying to enforce a singe connection per id. If a new connection comes in with the same id as an existing connection, I try to kill the old one and…
Tim Tisdall
  • 9,914
  • 3
  • 52
  • 82
1
vote
1 answer

python twisted: enforcing a single connection per id

I have a twisted server using SSL sockets and using certificates to identify the different clients that connect to the server. I'd like to enforce the state where there is only one connection by each possible id. The two ways I can think of is to…
Tim Tisdall
  • 9,914
  • 3
  • 52
  • 82
1
vote
1 answer

twisted run local shell commands with pipeline

In twisted, getProcessOutput method could get 'ps' shell command ouput by using getProcessOutupt('ps', 'aux') and return a defer. my question is how to run command like "ps aux | grep 'some keyword' | awk '{...}'" in getProcessOutput. for example…
Fujiao Liu
  • 2,195
  • 2
  • 24
  • 28
1
vote
1 answer

How to get a user's hostmask with Twisted IRCClient

I'm trying to get the hostmask for a user, to allow some authentication in my IRCClient bot. However, it seems to be removed from all responses? I've tried 'whois', but it only gives me the username and the channels the user is in, not the…
Tim Stoop
  • 346
  • 1
  • 12
1
vote
1 answer

Error trying to get uids of emails in large folders using IMAP and Twisted

I am writing an IMAP client using the last version of Twisted. I am having trouble using two different ways for getting email UIDs. First i have tried to use the search method this way : @inlineCallbacks def getEmailList(self): for f in…
MaxRic
  • 11
  • 2
1
vote
0 answers

Adding & reading options headers in IPv6 with Twisted

I'm working on a software-defined networking project, and I want to put a data tag into the destinations options header in an IPv6 UDP packet. I've been stumbling around a bit, and I ended up looking into Twisted 14.0, which seems to have some of…
1
vote
2 answers

python: twisted app with interacive python shell

Would it be possible to write a twisted-powered application that opens an interactive shell, e.g. to tweak the business objects served via the twisted protocol layer? My current problem is that the reactor.run() blocks the application, and the…
xtofl
  • 40,723
  • 12
  • 105
  • 192
1
vote
1 answer

Can Deferred.callback() or Deferred.errback() raise an exception to the caller?

Can there be a condition where calling .callback() or .errback() will raise an exception to the caller where it won't be captured by the deferred? Say I have the the following deferred and callbacks: from twisted.internet import defer def…
Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144
1
vote
1 answer

twisted: test if connection exists before writing to transport

Is there a possibility to test if the connection still exists before executing a transport.write()? I have modified the simpleserv/simpleclient examples so that a message is being send (written to Protocol.transport) every 5 seconds. The connection…
kev
  • 8,928
  • 14
  • 61
  • 103
1
vote
1 answer

Twisted - succes (or failure) callback for LineReceiver sendLine

I'm still trying to master Twisted while in the midst of finishing an application that uses it. My question is: My application uses LineReceiver.sendLine to send messages from a Twisted TCP server. I would like to know if the sendLine succeeded. I…
RoyHB
  • 1,715
  • 1
  • 22
  • 38
1
vote
1 answer

Twisted reactor.listenTCP intermittently cannot connect properly

I'm running a TCP server on linux using reactor.listenTCP. All works well for hours (or days), then something happens and clients can connect but they are immediately disconnected by the server. There is nothing in my protocol implementation that…
RoyHB
  • 1,715
  • 1
  • 22
  • 38
1
vote
0 answers

Running python script in windows..? ImportError: No module named 'twisted'

I am new to python. Here is my question. I have installed python 3.2 and my application is running fine. I am doing a client server socket tcp listen code in python. when I try to run the code in python shell it is throwing error saying that…
user2545522
  • 91
  • 1
  • 7
1
vote
1 answer

Getting unhandled error and connection get lost when a client tries to communicate with chat server in twisted

from twisted.internet.protocol import Protocol,Factory from twisted.internet import reactor class ChatServer(Protocol): def connectionMade(self): print "A Client Has Connected" self.factory.clients.append(self) print"clients are…
Jaassi
  • 57
  • 5
1
vote
2 answers

Twisted: How is Deferred called from EndPoint when using pyglet-twisted

The code below is taken from Twisted's documentation on AMP (link). When a callback is added to d, there's automatically a "protocol" argument added to it and the deferred is automatically run when reactor.run() is called. def connect(): …
Rob Guo
  • 152
  • 1
  • 5
1
vote
1 answer

Decorate the Port class from twisted.internet.udp

Is there any possibility to decorate the Port class from twisted.internet.udp ? I would like to modify the behavior of some methods of the Port class so that it looses or duplicates ... or delays packets from time to time. My goal is to "simulate"…
jean
  • 251
  • 4
  • 14