Note that there are some explanatory texts on larger screens.

plurals
  1. POPython UDP server on ubuntu not working
    text
    copied!<p>I am trying to run this script on a ubuntu 11.04 box: <a href="http://taoofmac.com/space/projects/ReGrowl" rel="nofollow">http://taoofmac.com/space/projects/ReGrowl</a></p> <p>Its a small script bound to UDP port 9887 designed to relay Growl packets.</p> <p>I can send the script Growl packets from the local machine and it works exactly as expected.</p> <p>However, when trying to send packets from another machine on my network they seem to be dropped or not make it to the script.</p> <p>I have configured ubuntu to allow the port and the output of netstat looks like this:</p> <pre><code>root@UbuntuVM:~# netstat -a | grep "udp" udp 0 0 localhost:9887 *:* udp 768 0 *:mdns *:* udp 0 0 *:mdns *:* udp 0 0 *:45030 *:* udp6 0 0 [::]:44730 [::]:* udp6 0 0 [::]:mdns [::]:* </code></pre> <p>My script is the first entry on the list.</p> <p>I have used wireshark and confirmed that the ubuntu machine is receiving the packets.</p> <p>Do I need todo anything to ubuntu to allow python to bind to UDP ports? Anyone know whats going on here?</p> <p>Thanks in advance!</p> <hr> <p>UPDATE:</p> <p>The output of the script should look like this:</p> <pre><code>127.0.0.1 - - [28/Sep/2011 12:30:27] REGISTER Network Responder 56 ['192.168.0.24', '192.168.0.140', '192.168.0.11', '192.168.0.25', '192.168.0.18', '192.168.0.28', '192.168.0.10', '192.168.0.30'] 127.0.0.1 - - [28/Sep/2011 12:30:27] NOTIFY ('Network Status', 'Connection Status', 'Test', 'Network Responder') 80 ['192.168.0.24', '192.168.0.140', '192.168.0.11', '192.168.0.25', '192.168.0.18', '192.168.0.28', '192.168.0.10', '192.168.0.30'] </code></pre> <p>The first IP is the source of the packet, and the array of IPs at the end are the destinations for the packet to be relayed to. As you can this packet originated from the local machine, if I send a packet form another machine its IP should apear first.</p> <p>Here is the portion of the script that implements the UDP server:</p> <pre><code>class GrowlRelay(UDPServer): """Growl Notification Relay""" allow_reuse_address = True def __init__(self, inpassword = None, outpassword = None): """Initializes the relay and launches the resolver thread""" self.inpassword = inpassword self.outpassword = outpassword self.resolver = RendezvousWatcher() self.resolver.start() UDPServer.__init__(self,('localhost', GROWL_UDP_PORT), _RequestHandler) def server_close(self): self.resolver.shutdown() </code></pre> <p>The full script and dependant classes are available and the link above.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload