Re: Bidirectional Networking

2008-12-16 Thread Emanuele D'Arrigo
Thanks everybody and in particular Gabriel and Bryan for their contributions to this thread. Very much useful information. Manu -- http://mail.python.org/mailman/listinfo/python-list

Re: Bidirectional Networking

2008-12-14 Thread Bryan Olson
Brian Allen Vanderburg II wrote: As for the backlog (5), this doesn't mean that you can only have a maximum of 5 established connections. Each established connection gets a new socket object. But what I think it means is that during the listen for an incoming connection on the listening sock

Re: Bidirectional Networking

2008-12-14 Thread Bryan Olson
Emanuele D'Arrigo wrote: Bryan Olson wrote: Software firewalls will often simply refuse incoming connections. The basic protection of the garden-variety home router comes from "network address translation" (NAT), in which case TCP connections initiated from the inside will generally work, regard

Re: Bidirectional Networking

2008-12-14 Thread Gabriel Genellina
En Sun, 14 Dec 2008 11:00:18 -0200, Emanuele D'Arrigo escribió: On Dec 14, 4:10 am, "Gabriel Genellina" wrote: daemon became a property in Python 2.6; setDaemon was the only way to set it in previous versions. I thought that might be the case! The documentation is a bit vague: http://d

Re: Bidirectional Networking

2008-12-14 Thread Emanuele D'Arrigo
On Dec 14, 2:40 am, Brian Allen Vanderburg II wrote: > But what I think it means is that during the listen for an incoming > connection on the listening socket, if multiple connection attempts are > coming in at one time it can keep a backlog of up to 5 of these > connection attempts for that indi

Re: Bidirectional Networking

2008-12-14 Thread Emanuele D'Arrigo
On Dec 14, 4:10 am, "Gabriel Genellina" wrote: > daemon became a property in Python 2.6; setDaemon was the only way to set > it in previous versions. I thought that might be the case! The documentation is a bit vague: http://docs.python.org/library/threading.html?highlight=threading#threading.Th

Re: Bidirectional Networking

2008-12-13 Thread Gabriel Genellina
En Sat, 13 Dec 2008 13:03:17 -0200, Emanuele D'Arrigo escribió: On Dec 12, 9:04 pm, "Gabriel Genellina" wrote: If you're using 2.5 or older, override serve_forever: def serve_forever(self): while not getattr(self, 'quit', False): self.handle_request() and set the

Re: Bidirectional Networking

2008-12-13 Thread Brian Allen Vanderburg II
man...@gmail.com wrote: On Dec 13, 11:13 pm, Bryan Olson wrote: Software firewalls will often simply refuse incoming connections. The basic protection of the garden-variety home router comes from "network address translation" (NAT), in which case TCP connections initiated from the inside wil

Re: Bidirectional Networking

2008-12-13 Thread Emanuele D'Arrigo
On Dec 13, 11:13 pm, Bryan Olson wrote: > Software firewalls will often simply refuse incoming connections. The > basic protection of the garden-variety home router comes from "network > address translation" (NAT), in which case TCP connections initiated from > the inside will generally work, rega

Re: Bidirectional Networking

2008-12-13 Thread Bryan Olson
Emanuele D'Arrigo wrote: Hey Bryan, thank you for your reply! Bryan Olson wrote: Is it possible then to establish both a server and a client in the same application? Possible, and not all that hard to program, but there's a gotcha. Firewalls, including home routers and software firewalls, typi

Re: Bidirectional Networking

2008-12-13 Thread Emanuele D'Arrigo
Hey Bryan, thank you for your reply! On Dec 13, 3:51 am, Bryan Olson wrote: > > Is it possible then to establish both a server and a client in the > > same application? > > Possible, and not all that hard to program, but there's a gotcha. > Firewalls, including home routers and software firewalls

Re: Bidirectional Networking

2008-12-13 Thread Emanuele D'Arrigo
On Dec 13, 12:08 am, "James Mills" wrote: > Just as a matter of completeness for my own suggestion, here > is my implementation of your code (using circuits): It's longer! But I bet is a little bit more resilient against all sorts of problems that arise while using network connections. Well, tha

Re: Bidirectional Networking

2008-12-13 Thread Emanuele D'Arrigo
On Dec 12, 9:04 pm, "Gabriel Genellina" wrote: > If you're using 2.5 or older, override serve_forever: > > def serve_forever(self): > while not getattr(self, 'quit', False): > self.handle_request() > > and set the server 'quit' attribute to True in response to some comma

Re: Bidirectional Networking

2008-12-12 Thread Bryan Olson
Emanuele D'Arrigo wrote: All the examples though are based on a client interrogating a server, with the client initiating the connection, obtaining something and then closing the connection. Basically the server is a reactive party: only if the client get in touch the server respond. Indeed, to

Re: Bidirectional Networking

2008-12-12 Thread James Mills
Just as a matter of completeness for my own suggestion, here is my implementation of your code (using circuits): cheers James -- import random from circuits import listener, Event, Manager from circuits.lib.sockets import TCPServer, TCPClient class Server(TCPServer):

Re: Bidirectional Networking

2008-12-12 Thread Gabriel Genellina
En Fri, 12 Dec 2008 15:22:34 -0200, Emanuele D'Arrigo escribió: Thank you both for the suggestions! Eventually I tried with threading as illustrated in the code below. And it works pretty well! The only problem I'm having with it is that as the server is a daemon the program should end when t

Re: Bidirectional Networking

2008-12-12 Thread Emanuele D'Arrigo
Thank you both for the suggestions! Eventually I tried with threading as illustrated in the code below. And it works pretty well! The only problem I'm having with it is that as the server is a daemon the program should end when the client thread cease to be alive. But it doesn't seem to work that w

Re: Bidirectional Networking

2008-12-11 Thread Tobias Andersson
Emanuele D'Arrigo skrev: [...] What if the server wanted to notify the client of something of interest, i.e. new data that the client should take into consideration and potentially process? If the protocol is relatively simple perhaps you can implement something similar to IMAP's "IDLE":

Re: Bidirectional Networking

2008-12-11 Thread James Mills
Have a look at circuits. http://trac.softcircuit.com.au/circuits/ It's a general purpose event-driven framework with a focus on Component architectures and has a good set of Networking Components, specifically: circuits.lib.sockets * TCPServer * TCPClient * UDPServer * UDPClient (alias of UDP

Bidirectional Networking

2008-12-11 Thread Emanuele D'Arrigo
Hi everybody! A networking question! I've been looking at and tinkering a little with the various networking modules in python. The examples are pretty clear and a module such as the SimpleXMLRPCServer is actually simple! All the examples though are based on a client interrogating a server, with