python socket Windows 10 connection times out









up vote
0
down vote

favorite












We recently upgraded a windows computer to Windows 10 from Windows 7, doing a completely clean installation of the OS. When it ran Windows 7, we hosted a couple of simple python socket servers so that another Linux computer on the network could interface with certain drivers on the Windows machine. This system (of binding a socket server to an open port and listening for a response) worked perfectly for the year leading up to this upgrade.



When we updated the OS on the windows machine, the same python scripts that previously set up a SOCK_STREAM server connection between the two computers stopped functioning. When asked to connect, the connection simply times out.



Does anyone know any changes that might have impacted socket's ability to listen on Windows 10, and/or any fixes to this issue? In a lot of digging we have been able to turn up no apparent fixes.



Here is a basic example of the code being ran on each computer.



Windows 10:



import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("XX.XX.XX.XX", XXXXX))
s.listen()
while True:
conn, addr = s.accept()
try:
conn.settimeout(3)
data = conn.recv(1024)
except:
break
if not data:break
# more code follows to process the data, etc.


On Linux:



import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10) # this timeout can change, and it just hangs indefinitely when removed
s.connect(("XX.XX.XX.XX",XXXXX))


The IP and Port referenced above as a series of X's are available and do not throw any bugs.










share|improve this question





















  • 90% of the time, this is a firewall issue, the other 10% is a firewall issue in the client machine
    – yorodm
    Nov 9 at 19:22














up vote
0
down vote

favorite












We recently upgraded a windows computer to Windows 10 from Windows 7, doing a completely clean installation of the OS. When it ran Windows 7, we hosted a couple of simple python socket servers so that another Linux computer on the network could interface with certain drivers on the Windows machine. This system (of binding a socket server to an open port and listening for a response) worked perfectly for the year leading up to this upgrade.



When we updated the OS on the windows machine, the same python scripts that previously set up a SOCK_STREAM server connection between the two computers stopped functioning. When asked to connect, the connection simply times out.



Does anyone know any changes that might have impacted socket's ability to listen on Windows 10, and/or any fixes to this issue? In a lot of digging we have been able to turn up no apparent fixes.



Here is a basic example of the code being ran on each computer.



Windows 10:



import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("XX.XX.XX.XX", XXXXX))
s.listen()
while True:
conn, addr = s.accept()
try:
conn.settimeout(3)
data = conn.recv(1024)
except:
break
if not data:break
# more code follows to process the data, etc.


On Linux:



import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10) # this timeout can change, and it just hangs indefinitely when removed
s.connect(("XX.XX.XX.XX",XXXXX))


The IP and Port referenced above as a series of X's are available and do not throw any bugs.










share|improve this question





















  • 90% of the time, this is a firewall issue, the other 10% is a firewall issue in the client machine
    – yorodm
    Nov 9 at 19:22












up vote
0
down vote

favorite









up vote
0
down vote

favorite











We recently upgraded a windows computer to Windows 10 from Windows 7, doing a completely clean installation of the OS. When it ran Windows 7, we hosted a couple of simple python socket servers so that another Linux computer on the network could interface with certain drivers on the Windows machine. This system (of binding a socket server to an open port and listening for a response) worked perfectly for the year leading up to this upgrade.



When we updated the OS on the windows machine, the same python scripts that previously set up a SOCK_STREAM server connection between the two computers stopped functioning. When asked to connect, the connection simply times out.



Does anyone know any changes that might have impacted socket's ability to listen on Windows 10, and/or any fixes to this issue? In a lot of digging we have been able to turn up no apparent fixes.



Here is a basic example of the code being ran on each computer.



Windows 10:



import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("XX.XX.XX.XX", XXXXX))
s.listen()
while True:
conn, addr = s.accept()
try:
conn.settimeout(3)
data = conn.recv(1024)
except:
break
if not data:break
# more code follows to process the data, etc.


On Linux:



import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10) # this timeout can change, and it just hangs indefinitely when removed
s.connect(("XX.XX.XX.XX",XXXXX))


The IP and Port referenced above as a series of X's are available and do not throw any bugs.










share|improve this question













We recently upgraded a windows computer to Windows 10 from Windows 7, doing a completely clean installation of the OS. When it ran Windows 7, we hosted a couple of simple python socket servers so that another Linux computer on the network could interface with certain drivers on the Windows machine. This system (of binding a socket server to an open port and listening for a response) worked perfectly for the year leading up to this upgrade.



When we updated the OS on the windows machine, the same python scripts that previously set up a SOCK_STREAM server connection between the two computers stopped functioning. When asked to connect, the connection simply times out.



Does anyone know any changes that might have impacted socket's ability to listen on Windows 10, and/or any fixes to this issue? In a lot of digging we have been able to turn up no apparent fixes.



Here is a basic example of the code being ran on each computer.



Windows 10:



import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("XX.XX.XX.XX", XXXXX))
s.listen()
while True:
conn, addr = s.accept()
try:
conn.settimeout(3)
data = conn.recv(1024)
except:
break
if not data:break
# more code follows to process the data, etc.


On Linux:



import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10) # this timeout can change, and it just hangs indefinitely when removed
s.connect(("XX.XX.XX.XX",XXXXX))


The IP and Port referenced above as a series of X's are available and do not throw any bugs.







python sockets windows-10






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 at 19:03









Julien Luebbers

348




348











  • 90% of the time, this is a firewall issue, the other 10% is a firewall issue in the client machine
    – yorodm
    Nov 9 at 19:22
















  • 90% of the time, this is a firewall issue, the other 10% is a firewall issue in the client machine
    – yorodm
    Nov 9 at 19:22















90% of the time, this is a firewall issue, the other 10% is a firewall issue in the client machine
– yorodm
Nov 9 at 19:22




90% of the time, this is a firewall issue, the other 10% is a firewall issue in the client machine
– yorodm
Nov 9 at 19:22












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










This is a firewall issue (like @yorodm said), so it is not the Python code that is making the mistake, it's the computer.



I can't give a solution for the Linux computer (I assume that it is running correctly, with the firewall allowing incoming connections), but I can for the Windows 10 computer.



So here is a solution:



Go to Start, and start Cortana. Type in "Allow an app through Windows Firewall", then tap the "Enter" key. Click on the "change settings" button, and next to "python.exe", check the box to the left, and if it isn't already enabled, the two to the right of python.exe.






share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    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',
    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%2fstackoverflow.com%2fquestions%2f53231849%2fpython-socket-windows-10-connection-times-out%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








    up vote
    0
    down vote



    accepted










    This is a firewall issue (like @yorodm said), so it is not the Python code that is making the mistake, it's the computer.



    I can't give a solution for the Linux computer (I assume that it is running correctly, with the firewall allowing incoming connections), but I can for the Windows 10 computer.



    So here is a solution:



    Go to Start, and start Cortana. Type in "Allow an app through Windows Firewall", then tap the "Enter" key. Click on the "change settings" button, and next to "python.exe", check the box to the left, and if it isn't already enabled, the two to the right of python.exe.






    share|improve this answer
























      up vote
      0
      down vote



      accepted










      This is a firewall issue (like @yorodm said), so it is not the Python code that is making the mistake, it's the computer.



      I can't give a solution for the Linux computer (I assume that it is running correctly, with the firewall allowing incoming connections), but I can for the Windows 10 computer.



      So here is a solution:



      Go to Start, and start Cortana. Type in "Allow an app through Windows Firewall", then tap the "Enter" key. Click on the "change settings" button, and next to "python.exe", check the box to the left, and if it isn't already enabled, the two to the right of python.exe.






      share|improve this answer






















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        This is a firewall issue (like @yorodm said), so it is not the Python code that is making the mistake, it's the computer.



        I can't give a solution for the Linux computer (I assume that it is running correctly, with the firewall allowing incoming connections), but I can for the Windows 10 computer.



        So here is a solution:



        Go to Start, and start Cortana. Type in "Allow an app through Windows Firewall", then tap the "Enter" key. Click on the "change settings" button, and next to "python.exe", check the box to the left, and if it isn't already enabled, the two to the right of python.exe.






        share|improve this answer












        This is a firewall issue (like @yorodm said), so it is not the Python code that is making the mistake, it's the computer.



        I can't give a solution for the Linux computer (I assume that it is running correctly, with the firewall allowing incoming connections), but I can for the Windows 10 computer.



        So here is a solution:



        Go to Start, and start Cortana. Type in "Allow an app through Windows Firewall", then tap the "Enter" key. Click on the "change settings" button, and next to "python.exe", check the box to the left, and if it isn't already enabled, the two to the right of python.exe.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 20:20









        MilkyWay90

        7810




        7810



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231849%2fpython-socket-windows-10-connection-times-out%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

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo