Is it possible to use python's socket library in


(Quick disclaimer: this is a question about the feasibility using sockets in, 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:

After running the code demonstrated in the video, nothing happened. Is it possible to use python's socket library in (specifically) I'm aware that javascript's socket library can work here, but I'm not quite sure about python's socket library.

If helpful, please see this code:

Thanks for your time,


You are viewing a single comment. View All

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 "" 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, 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.


@21natzil Got it, thank you so much for the help!


@21natzil How would you go about connecting to the server from another repl?