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
2
votes
1 answer

twistd and nohup &: what is the difference?

What are the advantages of using twistd over nohup? Why doing twistd -y service.tac when I can do: nohup sudo python my_app.py & ? I am asking this because I faced a difficulty to use twistd, see my question here
Mostafa
  • 1,501
  • 3
  • 21
  • 37
2
votes
1 answer

How to Process Data outside of Twisted thread

I am trying to write a UDP listener that performs an API call in response, but based on the data contained within the received UDP datagram. It appears callMultipleInThreads runs both functions in a single thread. Upon receiving a UDP datagram, I…
Ethan
  • 707
  • 3
  • 8
  • 17
2
votes
2 answers

Python SSH server (twisted.conch) command filtering and port forwarding

I need to create an SSH server (twisted.conch has been chosen for the job) which would do the following: Perform port forwarding (the attached code does not do that and I do not know what to modify) Filter commands BEFORE they are executed (or at…
Daniel
  • 21
  • 1
  • 4
2
votes
1 answer

Twisted Reactor for client-side python interface / raw_input

I am using twisted to run a rather complicated server that allows for data collection, communication, and commanding of a hardware device remotely. On the client-side there are a number of data retrieval and command operations available. Typically I…
scicalculator
  • 1,498
  • 3
  • 16
  • 33
2
votes
1 answer

CPU usage at the time of starting twisted reactor

I am monitoring CPU usage of python script which contains following code from twisted.internet import reactor, task def fun(): print "I don't know why CPU usage increases in the beginning" lc = task.LoopingCall(fun) lc.start(10) reactor.run() I…
Yudi
  • 831
  • 4
  • 10
  • 19
2
votes
1 answer

Run Twisted reactor from a Thread

When i run reactor from thread in a synchrone python program, the twisted code is never called. To resolve this problem, I had to put a sleep. def _reactor_thread(self): if not self.reactor.running: …
kadi
  • 184
  • 8
2
votes
1 answer

Stop reactor in Twisted.internet after a condition

I have a simple code in which I am testing how Twisted.internet module is working. I am trying to stop the loop when a certain condition occurs (e.g: when i equals to 5), but I couldn't get it run. I have two main errors: 1.…
sqya
  • 467
  • 1
  • 5
  • 10
2
votes
0 answers

Python Twisted sub process inter-communication

So we are writing a chat server with a web server and web client using Python twisted. The chat server is on main process and spawn a new sub process to run the web server and client. The main process (chat server) is required to send/receive events…
2
votes
1 answer

ReactorNotRestartable error

I have a tool, where i am implementing upnp discovery of devices connected in network. For that i have written a script and used datagram class in it. Implementation: whenever scan button is pressed on tool, it will run that upnp script and will…
Patrick
  • 2,464
  • 3
  • 30
  • 47
2
votes
1 answer

How to communicate between services?

I have two servers: application = service.Application("APP") factory_a = MyFactory() service_1 = internet.TCPServer(LPORT_1, factory_a) service_1.setServiceParent(application) factory_b = MyOtherFactory() service_2 = internet.TCPServer(LPORT_2,…
Nips
  • 13,162
  • 23
  • 65
  • 103
2
votes
2 answers

Twisted ReconnectingClientFactory - auto reconnect or explicitly call connector.connect()?

When using a Twisted ReconnectingClientFactory and the connection is lost do I need to call connector.connect() from within the clientConnectionLost method or does that happen automagically? The answer might seem obvious because it is, after all,…
RoyHB
  • 1,715
  • 1
  • 22
  • 38
2
votes
1 answer

"Unhandled Error" comes when TCP server tries to accept connections from client in twisted

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

Lazy Deferred List reaching maximum recursion depth

I have a large list of documents to upsert into MongoDB (possibly n > 100000). I don't want to create 100000 deferreds all at once, but I don't want to execute and wait for each query sequentially because I have a connection pool to MongoDB and I…
Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144
2
votes
1 answer

looping call in python twisted is not working

I am using python twisted for my real time project. Explanation: I am pulling the html pages for the url to which i give request to my remote machine.So,I am maintaining scheduler in my database machine which sends request to the remote machines…
Nava
  • 6,276
  • 6
  • 44
  • 68
1
vote
1 answer

How can I run a simple twisted client on top of asyncio?

I have the following client code that I borrowed from twisted's docs: https://docs.twistedmatrix.com/en/twisted-20.3.0/web/howto/client.html#the-agent And I am trying to run it with asyncio since I am building an asyncio project that requires…