Connection to localhost refused in Ubuntu subsystem on Windows












0















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 connect
self.sock.connect((host, port))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return 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).










share|improve this question





























    0















    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 connect
    self.sock.connect((host, port))
    File "/usr/lib/python2.7/socket.py", line 228, in meth
    return 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).










    share|improve this question



























      0












      0








      0








      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 connect
      self.sock.connect((host, port))
      File "/usr/lib/python2.7/socket.py", line 228, in meth
      return 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).










      share|improve this question
















      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 connect
      self.sock.connect((host, port))
      File "/usr/lib/python2.7/socket.py", line 228, in meth
      return 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).







      windows networking ubuntu windows-subsystem-for-linux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 '17 at 14:54









      Scott

      15.9k113990




      15.9k113990










      asked Nov 10 '17 at 14:36









      Piyush BansalPiyush Bansal

      12




      12






















          1 Answer
          1






          active

          oldest

          votes


















          0














          If you're using third-party antivirus/firewalls in Windows, try temporarily deactivating them and see if the connection goes back to normal. As a security measure you can temporarily use the built-in Windows antivirus/firewall programs instead.



          It's a known issue that third-party firewalls do not behave well with Windows Subsystem for Linux. See No internet with 3rd party AV/Firewall and apt-get update and install failing for details.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1267267%2fconnection-to-localhost-refused-in-ubuntu-subsystem-on-windows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            If you're using third-party antivirus/firewalls in Windows, try temporarily deactivating them and see if the connection goes back to normal. As a security measure you can temporarily use the built-in Windows antivirus/firewall programs instead.



            It's a known issue that third-party firewalls do not behave well with Windows Subsystem for Linux. See No internet with 3rd party AV/Firewall and apt-get update and install failing for details.






            share|improve this answer




























              0














              If you're using third-party antivirus/firewalls in Windows, try temporarily deactivating them and see if the connection goes back to normal. As a security measure you can temporarily use the built-in Windows antivirus/firewall programs instead.



              It's a known issue that third-party firewalls do not behave well with Windows Subsystem for Linux. See No internet with 3rd party AV/Firewall and apt-get update and install failing for details.






              share|improve this answer


























                0












                0








                0







                If you're using third-party antivirus/firewalls in Windows, try temporarily deactivating them and see if the connection goes back to normal. As a security measure you can temporarily use the built-in Windows antivirus/firewall programs instead.



                It's a known issue that third-party firewalls do not behave well with Windows Subsystem for Linux. See No internet with 3rd party AV/Firewall and apt-get update and install failing for details.






                share|improve this answer













                If you're using third-party antivirus/firewalls in Windows, try temporarily deactivating them and see if the connection goes back to normal. As a security measure you can temporarily use the built-in Windows antivirus/firewall programs instead.



                It's a known issue that third-party firewalls do not behave well with Windows Subsystem for Linux. See No internet with 3rd party AV/Firewall and apt-get update and install failing for details.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 27 at 14:36









                karelkarel

                9,27093139




                9,27093139






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1267267%2fconnection-to-localhost-refused-in-ubuntu-subsystem-on-windows%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...