I am trying to connect to a server using python 3 with xml-rpc, but an error is appearing every time I try to connect: ConnectionRefusedError: [Errno 111] Connection refused
This is my server code: (NOTE: I'm just doing silly tests.)
from xmlrpc.server import SimpleXMLRPCServer
def void():
x = 1000
i = 0
while i < x:
i = i+1
return True
def main():
print("This is a server!")
server = SimpleXMLRPCServer(("localhost", 8080))
server.register_function(void)
server.serve_forever()
if __name__ == "__main__":
main()
This is my client code:
import xmlrpc.client
import time
def main():
print("This is a client!")
client = xmlrpc.client.ServerProxy("http://localhost:8000")
client.void()
if __name__ == "__main__":
start = time.time()
main()
total_time = ("--- %s seconds ---" % (time.time() - start))
print("Time: " + str(total_time))
When I run xml-rpc on the same computer (different terminal) it works fine, but when I try on two different computers, it gives this error.