I am trying to UDP broadcast from a Python program to two LabView programs. I cannot seem to get the broadcast to send and I am not sure where my socket initialization is wrong, broadcasting seems simple enough?? As far as I can see, there is no data being received by the other PC's. Also, I will need this program to receive data back from the other PC's in the future. It seems like that shouldn't complicate things but every step of the way has been complicated for me!
Background: I have zero software experience, this is just something I was assigned at work. Any help is appreciated. Code is below. Python 2.7.
from threading import Thread
import time
from socket import *
cs = socket(AF_INET, SOCK_DGRAM)
cs.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
cs.connect(('<broadcast>', 5455))
while 1:
cmd = int(raw_input('send: '))
if (cmd == 1):
cs.send('1')
time.sleep(1)