PDA

Bekijk de volledige versie : UDP Broadcast to LAN from python script



mzhuravlev
11-11-2016, 07:12
Comrads, please help!
I have a Python script, that is correct work on the Ubuntu workstation in LAN, connected to the WL500. Script send the UDP broadcast packet to the network and work very well.
I'm trying to start this script on the WL-500GPv2 with a this (https://github.com/wl500g/wl500g) firmware.
When i try to change the broadcast UDP adress to LAN IP address that script work well, but i need to work with broadcast.

What a hell, probably my problem with a iptables routing, but i don`t enaght knowlege to understant what i need change to make it work well.

Please help me to issue.

The my Python script is below.

#!/opt/bin/python
import sys, os, socket
addr = ('255.255.255.255', 1111)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
t_s ="000000000000000"
sock.sendto(t_s, addr)
sock.close()

The chalenge have solved allready. I was need to bind socket to network interface.