0

I have been trying to figure this out for a few days and I just cannot get it to work. I simply want to send a string from one computer to another one which are on 2 different networks using python. I have tried:

using python socket to connect to an ngrok address (not possible apparently)

pyngrok tcp server (requires me to pay for a reserved address)

and a few other methods but none of them work. If someone could please tell me the simplest, free way to go about this I would much appreciate it

Tanuj KS
  • 155
  • 2
  • 14
  • 1
    Are the two machines on the Internet? Are you able to run software you make on both machiens? If so, you can do this by opening a socket between the two IP addresses. – Code-Apprentice Oct 29 '20 at 22:55
  • not sure if there is a free way gonna take a look – Matiiss Oct 29 '20 at 22:57
  • ok so I found a tutorial that may help you here it is: [link](https://www.youtube.com/watch?v=KQasIwElg3w&list=PLzMcBGfZo4-kR7Rh-7JCVDN8lm3Utumvq&index=10) – Matiiss Oct 29 '20 at 22:59
  • @Code-Apprentice yes they both are but sockets only work if they are on the same network (if you don't use ngrok) – Tanuj KS Oct 29 '20 at 23:04
  • check tutorial I commented – Matiiss Oct 29 '20 at 23:06
  • @Matiiss that is not free again he uses a free trial so it would only last 4 months, this would work short term but is there anything that's more long term? – Tanuj KS Oct 29 '20 at 23:17
  • paying money (as far as I know its not that expensive to buy a static IP) – Matiiss Oct 29 '20 at 23:19
  • 1
    I don't think it is true that two computers must be on the same network to use sockets. at least all the standard protocols (TCP, HTTP, telnet, ssh, stmp, pop, etc.) all use sockets under the hood between computers on different networks. I don't know the exact details in Python, but it seems like it should be entirely doable with sockets directly or with a higher-level protocol. – Code-Apprentice Oct 29 '20 at 23:43
  • @Code-Apprentice if you could, I would love it If could try and help. I posted my code over [here](https://stackoverflow.com/questions/64594627/python-socket-not-connecting-to-web-server/64594954?noredirect=1#comment114224491_64594954) but none of the things people suggested work, and someone said I couldn't do it this way – Tanuj KS Oct 30 '20 at 00:09
  • @TanujKS So if I understand correctly, the problem isn't that you are on separate networks, it's that one or both machines don't have a publically available IP address. In other words, they aren't on the Internet directly but connect through a router. So yah, that means you can't connect with a socket directly. – Code-Apprentice Oct 30 '20 at 01:51

0 Answers0