nonblocking

python check socket receive within other loop — non-blocking?

python check socket receive within other loop — non-blocking? Question: I know the code to wait for socket in a loop like this. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((host, port)) data, addr = s.recvfrom(1024) data = data.decode(‘utf-8’) print("Message from: " + str(addr)) print("From connected user: " + data) com = data data = data.upper() data = …

Total answers: 1

Python non-blocking socket

Python non-blocking socket Question: 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. import sys import socket import select import threading # Bind to socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((‘127.0.0.1’, 11111)) s.listen() def …

Total answers: 1

PyAudio Responsive Recording

PyAudio Responsive Recording Question: I’ve seen the recording tutorial on the PyAudio website for recording a fixed length recording, but I was wondering how I could do the same with a non-fixed recording? Bascially, I want to create buttons to start and end the recording but I haven’t found anything on the matter. Any ideas, …

Total answers: 3

PySerial non-blocking read loop

PySerial non-blocking read loop Question: I am reading serial data like this: connected = False port = ‘COM4’ baud = 9600 ser = serial.Serial(port, baud, timeout=0) while not connected: #serin = ser.read() connected = True while True: print(“test”) reading = ser.readline().decode() The problem is that it prevents anything else from executing including bottle py web …

Total answers: 4

Write PHP non blocking applications

Write PHP non blocking applications Question: I want to write non-blocking applications. I use apache2, but I was reading about nginx and its advantage with respect to apache processes. I am considering changing out apache for nginx. My question is, is it possible to write non-blocking web applications with php and nginx?. Or is a …

Total answers: 5

Can SQLAlchemy be configured to be non-blocking?

Can SQLAlchemy be configured to be non-blocking? Question: I’m under the impression that database calls through SQLAlchemy will block and aren’t suitable for use in anything other than synchronous code. Am I correct (I hope I’m not!) or is there a way to configure it to be non-blocking? Asked By: Matty || Source Answers: Have …

Total answers: 3

using Flask and Tornado together?

using Flask and Tornado together? Question: I am a big fan of Flask – in part because it is simple and in part because has a lot of extensions. However, Flask is meant to be used in a WSGI environment, and WSGI is not a non-blocking, so (I believe) it doesn’t scale as well as …

Total answers: 2

SSH module for python

SSH module for python Question: I have to do a job (using my web server) on a remote machine that takes about 10 minutes. I have used pxssh module in python for the same but it gives me “timeout error”(non blocking). Now, I am using paramiko but that comes back as soon as it gives …

Total answers: 1

Python socket.accept nonblocking?

Python socket.accept nonblocking? Question: Is there a way I can use python’s socket.accept() in a non-blocking way that simply runs it and lets me just check if it got any new connections? I really don’t want to use threading. Thanks. Asked By: pajm || Source Answers: You can invoke the setblocking(0) method on the Socket …

Total answers: 3