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.run UntilCurrent. 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
0 1448 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 question is asyncore / asynchat. I
have read that twisted makes this all simple, but, I wanted to get my hands
dirty here for educational purposes.
I've managed to build a small echo server with asyncore and asynchat that can
handle any number of...
|
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 __init__(self,*args):
asynchat.async_chat.__init__(self,*args)
self.set_terminator(BLOCKEND)
self.data=
def collect_incoming_data(self,data):
self.data.append(data)
|
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 use on our LAN - nothing heavy duty, as
99% of my reason for doing this is just to learn.
I got my server portion working well, and I think I understand the basics.
Where I'm getting stuck is on the client side, where I'm trying to involve...
|
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 receiving is perfect, but
about 1 out of 10 times, it fails with one of these errors:
-- Problem 1. When sending data, I sometimes the following exception:
Handler connected 127.0.0.1:1242 at 0x2977800> (socket.error:(9, 'Bad
file descriptor')
|
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 blocking".
So how do I enable blocking with synchat, or otherwise fix this error?
Thanks for the help I've received with asynchat so far in this news group.
| |
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 echo_client(asynchat.async_chat):
def __init__(self):
asynchat.async_chat.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
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:
self.push_with_producer(ProducerA())
return asynchat.async_chat.readable(self)
|
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.
Jean-Paul
|
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:
|
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:
import asyncore, asynchat, socket
class http_client(asynchat.async_chat):
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |