Start New Discussion within our Software Development Community

I started looking into networking and storing/altering data on a computer. I've got everything running, but can't get it to work from an outside computer. Is there an easy way to get past the LAN restrictions or am I going to have to change settings on my router?

I just dealt with this, asked for help in a post here but didn't get much help. It has to do with nat traversal which can be done from your computer. Hours of googling led me to uPnP. You have to forward public requests to your local (private) ip address. I've attached the files that I found and modified to suite my purposes. Here is the actual implementation of the code.

class Ports(object):
   def __init__(self):
      # create a folder in c:\\python2x\\lib called uPnP
      # and extract the zip contents there
      from uPnP.natpunch import _upnp_
      self.ports = []
      self.uPnP = _upnp_

   def open(self, *ports):
      for port in ports:
         if not port in self.ports:
            print 'opening port', port
               print 'retrying to open port', port

   def closeall(self):
      print 'closing ports %s' % (', '.join([str(x) for x in self.ports]))
      self.ports = [p for p in self.ports if not self.uPnP.close(p)]

   def __del__(self):

ports = Ports()
# will go through the process of testing
# the best method to open the router ports
# should open port 15000
# keep the 'ports' reference alive
# otherwise it will close the ports
# when it is garbage collected (the __del__ method)

Also helpful was pyStun which allows to get easily get your public ip address programmatically.

This question has already been answered. Start a new discussion instead.