Hi I am trying to create a very simple peer-to-peer chatting program in python. The first user can runs the server.py program below to bind to a socket. Then another user can use netcat to connect to the server and communicate. However, the program is only able to get the user’s input and send to the ot…
Tag: nonblocking
Why does this function block?
I have some code that is reading data (if there is any) from a non-blocking socket and printing it, but somehow when this happens (data is received & printed) the function then blocks and does not return unless I kill the sending process (which also uses a non-blocking stream to send the data). Obviously …
AttributeError: module ‘socket’ has no attribute ‘setblocking’
I’m trying to use ‘non-blocked socket’ for a Python project (see previous question if anyone has a better answer : How to use a socket without waiting in python ) I saw that people on the site suggested using the command: socket.setblocking () But when I run the program it crashes, and the e…