Hey all, I keep getting a connection error 111 connection refused. When i try to connect to a server at a remote ip address.
I am using linux on both computers. the socket server looks like this: #!/usr/bin/python import SocketServer class MyTCPHandler(SocketServer.BaseRequestHandler): def handle(self): self.data = self.request.recv(1024).strip() print "%s wrote:" % self.client_address[0] print self.data # just send back the same data, but upper-cased self.request.send(self.data.upper()) if __name__ == "__main__": HOST, PORT = "127.0.0.1", 3000 # Create the server, binding to localhost on port 9999 server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler) # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever() and the client looks like this: #!/usr/bin/python import socket import sys HOST, PORT = "ip.address.of.server", 3000 data = "hello world" # Create a socket (SOCK_STREAM means a TCP socket) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect to server and send data sock.connect((HOST, PORT)) sock.send(data + "\n") # Receive data from the server and shut down received = sock.recv(1024) sock.close() print "Sent: %s" % data print "Received: %s" % received the server starts fine on the remote computer, but the client dies immediatly when executed ( to time to find the server, i don't think) with the connection refused error. The port forwarding is set up correctly on both computers, i know because i have another app that runs on 3000 ( but is not running when i am trying this) any tips would be greatly appreciated, thanks sk
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor