14from binascii
import unhexlify
17def send(msg, ip_send, port_send):
18 sk_send = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
19 sk_send.sendto(msg, (ip_send, port_send))
24 listen_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
25 listen_socket.bind((ip_listen, port_listen))
32 print(
'Starting intersect.')
33 ip_listen =
'127.0.0.1'
34 ip_send =
'192.168.0.146'
38 sk_listen =
listen(ip_listen, port_listen)
40 print(
"Waiting to receive data\n")
42 data = sk_listen.recvfrom(10000)[0]
43 data = data.decode(
'ascii')
46 idx = data.find(
"Payload=")
47 payload = data[idx+8:-1]
48 encoded = payload.encode(
'utf-8')
49 msgBytes = unhexlify(encoded)
52 send(msgBytes, ip_send, port_send)
55if __name__==
"__main__":
def listen(ip_listen, port_listen)
def send(msg, ip_send, port_send)