receive01.py

# =========================================================
# Receive UDP broadcast packets
#
# From: https://stackoverflow.com/questions/22878625/
#       receiving-broadcast-packets-in-python
# =========================================================

from socket import *

MYPORT = 10000


s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', MYPORT))

while(1):
    m=s.recvfrom(1024)
    print('------------------------------------------------')
    print('len(m)='+str(len(m)))

    print('len(m[0])='+str(len(m[0])))    
    print(m[0])

    print('len(m[1])='+str(len(m[1])))   
    print(m[1])