473,498 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: asynchat sends data on async_chat.push and .push_with_producer

On Tue, 13 May 2008 20:56:03 -0400, Jean-Paul Calderone <ex*****@divmod.comwrote:
>On Tue, 13 May 2008 16:44:11 -0700 (PDT), Giampaolo Rodola'
<gn****@gmail.comwrote:
>>
[snip]
>>>
To support scheduling calls, you just have to know when the next call is
going to happen. Then, you can wake up at exactly that time. This is
what Twisted does, even for select reactor. ;)

Yes but how do you know when it's the time to fire up a call without
using a thread?
You are forced to call time.time() periodically and check if that time
had come every time.
Take a look at twisted/internet/base/ReactorBase.runUntilCurrent.
That's where that should happen.

Why? Isn't this why subtraction exists? If there is a call scheduled to
happen at T1 and the current time is T2, then I know that after (T1 - T2)
elapses, it will be time to run the call. Why do I have to do any checks
at all? I just tell select() to wait that long. Presumably this is just
what someone will do if they want to use asyncore with timed calls. Call
asyncore.loop() in a loop, always passing (T1 - T2) as the timeout value.
Ah, of course this is wrong, since asyncore.loop... loops. :P I meant to
say asyncore.poll() here.
>So, actually, I'm not sure what the disagreement is about. ;) The
default value for the timeout parameter to the loop function seems
somewhat irrelevant. If someone wants timed events in their loop,
asyncore isn't standing in their way. On the other hand, I didn't
this thread (or maybe just this part of the thread) start out with
a question about asyncore throughput? I have no idea what that
might have to do with this.

Jean-Paul
Jun 27 '08 #1
0 1414

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2689
by: Michael Welsh | last post by:
In order to learn sockets in Python I am trying to write a simple group chat server and client. I need a little nudge, please. My question contains some GUI but only as decoration. The root...
1
2162
by: Patrick Useldinger | last post by:
I am trying to write both a server and a client using asynchat. For both, I have created a common subclass to collect the incoming data: class SingleServer(asynchat.async_chat): def...
16
3244
by: Rob Snyder | last post by:
Greetings - I've embarked on a small learning project, trying to get a better grasp of the asyncore and asynchat modules. The project involves building a simple instant messenger application for...
1
1572
by: Andreas R. | last post by:
Hello, I'm using Python's asynchat module for network support in a Python-based game, and I run into two problems, both of which occur at random times. Most of the time, the network sending and...
8
2590
by: Andreas R. | last post by:
Hi again, I'm using Python's asynchat module for networking. When calling the sendall() method of asynchat, I sometimes get the error message "the operation could not complete without...
0
1286
by: Z. Kotzer | last post by:
I can not get error notifications when an asynchat based client tries to connect to a non-responsive address. To validate the problem I changed lib/test/test_asynchat.py as follows: class...
5
2444
by: ludvig.ericson | last post by:
Hello, My question concerns asynchat in particular. With the following half- pseudo code in mind: class Example(asynchat.async_chat): def readable(self): if foo:...
1
176
by: Jean-Paul Calderone | last post by:
On Tue, 13 May 2008 11:50:30 -0700 (PDT), Giampaolo Rodola' <gnewsg@gmail.comwrote: I'm not sure this is right. What timeout are we talking about? Twisted only wakes up when necessary. ...
0
1123
by: davy zhang | last post by:
Python3.0rc1 windowsxp in the lib\asynchat.py def handle_write (self): self.initiate_send() def push (self, data): sabs = self.ac_out_buffer_size if len(data) sabs:
0
1143
by: Orestis Markou | last post by:
Hello, I'm trying to add some better error handling to an async_chat client. What I want is to retry or terminate gracefully if the connection to the server doesn't succeed. Here's what I have:...
0
7121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7197
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6881
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.