Do vision while waiting for streaming connexion

Hello,
I am doing a video streaming to a device (I started from the mpeg_streamer.py example).
The question is that I need to execute a vision algorithm also while waiting to a client to connect, but the call:
client, addr = s.accept() blocks the code.
I have tried creating a timing interrupt but it doesn’t allow the call:
frame = sensor.snapshot() - (the interrupt function doesn’t allow memory allocation)
Is there a way to do some kind of thread or similar?
Thanks in advance.

@iabdalkader

The only way to do this would be via usyncio. I don’t know how to use this with the TCP however. Ibrahim knows more.

You could use s.settimeout() and call accept() in a Try/Catch OSError block.