Is it possible to use python's socket library in repl.it?
(Quick disclaimer: this is a question about the feasibility using sockets in repl.it, not about how to use the library itself. Also, I'm definitely no expert whatsoever. Thanks!)
I've been trying to expand my own knowledge about python, and I've wanted to start learning more about online networks, clients, servers, etc. I've been watching a tutorial about python sockets here: https://www.youtube.com/watch?v=Lbfe3-v7yE0
If helpful, please see this code: https://repl.it/@ETHANSIAO/CheapDemandingDecompilers
Thanks for your time,
Yes, and no. Yes you can create sockets, and they will behave normally. The problem with your code is that you're using gethostname. Replace that with
"0.0.0.0" which means it will bind to the computer, but be accessible externally. The reason I say no, is that whenever you open a socket and bind it to the repl, repl.it is tricked into thinking you started an HTTP server (A web server). It will then start requesting your website, which may cause issues with your code. It will also convert any request other people made to the repl into HTTP.