pythonpython-2.7urirpcsimplexmlrpcserver

Python SimpleXMLPRCServer address


Based on the answer on my previous question, i am testing out XMLPRC module. While looking through the documentation, I found this code line:

server = SimpleXMLRPCServer(("localhost", 8000))

which basically creating an instance of SimpleXMLRPCServer that is listening to port 8000 on my local PC. So, according to the docs, the client will have this code line where it gets the server address

proxy = xmlrpclib.ServerProxy("http://localhost:8000/")

My question is, if I want to connect to a remote PC (which has an instance of SimpleXMLPRCServer running with appropriate methods) over the internet, how do I address that server from my client PC?

proxy = xmlrpclib.ServerProxy("Address of my server?")

Should i put the IP address of server instead of localhost? But if that's the case, how do i set my server PC up so that it has static IP address instead of normal dynamic IP?


Solution

  • An approach - Very high level.

    For your remote PC to be accessible over the internet, you need to have a public facing IP address (from your internet service provider) with one of the following configurations:

    In either case, you can find your public facing IP address by going to google.com and typing "public ip".

    Assuming your internal server can be directly reached using one of the two methods you can access your XMLRPC service using PUBLIC_IP:8000 instead of localhost:8000