non blocking read from socket

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
thk4711
 
Posts: 1
Joined: Thu Dec 01, 2022 2:39 pm

non blocking read from socket

Post by thk4711 »

I want to talk to a wireless audio device with an raspberry pico w. The device can be controlled using tcp socket communication. There it will send data if for instance new metadata is available. At the same time the raspberry should also check if some buttons are pressed. Now my problem is that I receive data from socket like:

Code: Select all

my_socket.recv_into(buff)
This will wait until data is available and nothing else can be done.
Is there a way to for instance just check if data is available in a loop and only read it if it's there. That would make it possible to do other things while waiting for new data from the socket.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”