Does socket programming in Python or C work on Replit?

** Does socket programming in Python or C work on Replit?

I have just begun to work with socket programming on this platform, only to notice a couple issues when establishing connections. Whenever I try to use 0.0.0.0 as an ip, Replit opens a webview tab and interprets it as an http request.

Hello @TriTechX!
0.0.0.0 is not an IP. If you are trying to request the current device, use 127.0.0.1 instead.
Hope this helps!

I don’t think that’s correct: it is a valid IP address, but a reserved one, for instance you can’t use it as a destination address.

@TriTechX I’ve worked my way through most of Beej’s Guide to Networking Concepts (highly recommended) on Replit, which includes quite a bit of socket programming, without any problems (at least I don’t remember running into any).

4 Likes

It’s the IP you have to host things on on Replit if you want the Internet to be able to reach them. If you try 127.0.0.1, you’ll get a pop-up saying to host on 0.0.0.0.

4 Likes

Thanks for the reply (and the document about networking that’ll certainly be useful)!

I’ve noticed that Socket - on its own - works perfectly fine, but when I try to connect one Repl to another via Socket, it doesn’t seem to work.
I think this might be because Replit is using virtual machines to run it and some of them may be connected to different networks and so on. I was wondering if it was possible to connect two Repls in any way at all.

Sorry, I’m not able to give a reliable answer to your question. :pensive: As far as I remember, I’ve tried only intra-repl connections which worked fine (something like: running a server in one shell and a client in another). I’m not sure how the routing between repls works, if it works at all.

1 Like