lantcpsocket

How do I connect two computers using the same router?


I’m using the python socket module on a Mac.

How do I connect two computers using the same router? I need a TCP socket with fast data passing between.

When I tried just hooking two computers up by their private ip address, then I got a Connection Refused error. How do I do this?


Solution

  • You can check first whether connection is allowed between two devices by going to one device and running telnet.

    telnet <Private-IP-of-Second-Device> <Port>
    

    If this shows connected then connectivity is good and issue exists with the socket module you have written. If this fails you can try checking the firewall by going to System Preferences > Security & Privacy > Firewall.