how to make a UDP python localhost go public
Question: I have a python localhost set up on a raspberry pi to listen for UDP packets.
But I'm wondering how I can make this a public server in order to send UDP
packets from roaming devices.

The below code works perfectly sending UDP packets from a device on the same
wireless network.

    
    
    import SocketServer
    
    PORTNO = 14
    
    class handler(SocketServer.DatagramRequestHandler):
        def handle(self):
            newmsg = self.rfile.readline().rstrip()
        print (newmsg)
            self.wfile.write(self.server.oldmsg)
            self.server.oldmsg = newmsg
    
    s = SocketServer.UDPServer(('',PORTNO), handler)
    print "Awaiting UDP messages on port %d" % PORTNO
    s.oldmsg = "This is the starting message."
    s.serve_forever()
    


Answer: This is more a networking issue. You will have to configure your router with
appropriate [port forwarding](http://en.wikipedia.org/wiki/Port_forwarding).
If your ISP does not have static IP's you may also need to set-up some
[dynamic DNS](http://dyn.com/dns/) service.

The NAT traversal required to connect to external networks requires a static
IP outside the 192.168._._ or 10._._.* range. This is typically assigned by
the ISP DHCP server to the external facing MAC Address of the router.

The port forward settings are shown here: ![D_Link port
forward](http://i.stack.imgur.com/8KTfA.jpg)

