[Twisted-Python] UDP asynchronous communication
Hello, First of all I must let you know that I am new to Twisted. I need to implement a server discovery mechanism for my application. The way I chose to implement it is this: 1. The client, when started, sends a broadcast message requesting servers to make their presence known (UDP broadcast) 2. The server responds to this request using the same port on the sender's IP to reply (UDP normal message) 3. ... Now the problem I faced is that from the examples I found on the web (http://twisted.sourceforge.net/TwistedDocs-1.1.0/howto/udp.html), for multicast UDP messages, are done using listenUDP on both sides (server and client) and this approach is not good for me because I need a non-blocking communication mechanism on the client-side.
Adrian Libotean wrote:
Now the problem I faced is that from the examples I found on the web (http://twisted.sourceforge.net/TwistedDocs-1.1.0/howto/udp.html), for multicast UDP messages, are done using listenUDP on both sides (server and client) and this approach is not good for me because I need a non-blocking communication mechanism on the client-side.
Sounds _very_ much like you have misunderstood something. Twisted functionality is almost without exception non-blocking. Please re-read and try to ask a more specific question.
On Sun, 2005-04-10 at 18:08 +0300, Tommi Virtanen wrote:
Adrian Libotean wrote:
Now the problem I faced is that from the examples I found on the web (http://twisted.sourceforge.net/TwistedDocs-1.1.0/howto/udp.html), for multicast UDP messages, are done using listenUDP on both sides (server and client) and this approach is not good for me because I need a non-blocking communication mechanism on the client-side.
Sounds _very_ much like you have misunderstood something. Twisted functionality is almost without exception non-blocking. Please re-read and try to ask a more specific question.
Also note those docs are *very* out of date - multicast uses listenMulticast these days. Other than that it's mostly identical though.
On Apr 10, 2005 9:13 AM, Adrian Libotean <adrian.libotean@asylum-studios.ro> wrote:
Hello,
First of all I must let you know that I am new to Twisted.
I need to implement a server discovery mechanism for my application. The way I chose to implement it is this:
1. The client, when started, sends a broadcast message requesting servers to make their presence known (UDP broadcast) 2. The server responds to this request using the same port on the sender's IP to reply (UDP normal message) 3. ...
Now the problem I faced is that from the examples I found on the web (http://twisted.sourceforge.net/TwistedDocs-1.1.0/howto/udp.html), for multicast UDP messages, are done using listenUDP on both sides (server and client) and this approach is not good for me because I need a non-blocking communication mechanism on the client-side.
_______________________________________________
Why are you re-inventing the wheel, Dynamic Server discovery is already implemented with ZeroConf ( also known as Rendezvous on OSX ) thru mDNS. I have working example code for twisted that I got form people on this list if you want to see it. -- If you don't know what you want, you probably need a nap.
A few reasons for this are: 1. I can have multiple servers running on the same machine (single Ip address) on different ports 2. The server must reply with more than just an IP: it sends to the client specific data: amonst wich is the TCP port that the server is listening for connections from the client which can vary according to settings jarrod roberson wrote:
On Apr 10, 2005 9:13 AM, Adrian Libotean <adrian.libotean@asylum-studios.ro> wrote:
Hello,
First of all I must let you know that I am new to Twisted.
I need to implement a server discovery mechanism for my application. The way I chose to implement it is this:
1. The client, when started, sends a broadcast message requesting servers to make their presence known (UDP broadcast) 2. The server responds to this request using the same port on the sender's IP to reply (UDP normal message) 3. ...
Now the problem I faced is that from the examples I found on the web (http://twisted.sourceforge.net/TwistedDocs-1.1.0/howto/udp.html), for multicast UDP messages, are done using listenUDP on both sides (server and client) and this approach is not good for me because I need a non-blocking communication mechanism on the client-side.
_______________________________________________
Why are you re-inventing the wheel, Dynamic Server discovery is already implemented with ZeroConf ( also known as Rendezvous on OSX ) thru mDNS.
I have working example code for twisted that I got form people on this list if you want to see it.
participants (4)
-
Adrian Libotean
-
Itamar Shtull-Trauring
-
jarrod roberson
-
Tommi Virtanen