I know using sockets may not be the best way to do this but I've got pretty some simple code developed where I send data from one Raspberry Pi to another using Python sockets (UDP) but I haven't been able to find an example on how to create an interrupt for when data is received. Basically I've got a process running and I don't want it to be held waiting for data to be received by s.recvfrom. I attached basic code below and I could use some help pointing me in the right direction.
import socket
import sys
import os
UDP_IP = '192.168.0.96'
UDP_PORT = 5008
data = "abcd"
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', UDP_PORT))
while(1)
data, addr = s.recvfrom(1024)