I have made a server-client model in python on Linux. When I run the server on Ubuntu Subsystem on Windows, it works just fine. But when I run the client(which tries to connect to the server) I get this error:
Traceback (most recent call last):File "client.py", line 64, in <module>s.connect('127.0.0.1',port)File "client.py", line 19, in connectself.sock.connect((host, port))File "/usr/lib/python2.7/socket.py", line 228, in methreturn getattr(self._sock,name)(*args)socket.error: [Errno 111] Connection refused
The server is listening on localhost and port = 14345 and client is trying to connect to the same. I also tried telnet 127.0.0.1 14345
and it gave me same error:
Trying 127.0.0.1...telnet: Unable to connect to remote host: Connection refused
I also tried netstat -an
in cmd on Windows and it showed this
TCP 127.0.1.1:14345 0.0.0.0:0 LISTENING
This means the server is indeed listening, but the client from Linux subsystem is not able to connect to it.
Also the code is working fine on real Linux (I mean Ubuntu installed on hard disk).