13from binascii
import unhexlify
16def send(msg, ip_send, port_send):
17 sk_send = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
18 sk_send.sendto(msg, (ip_send, port_send))
23 listen_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
24 listen_socket.bind((ip_listen, port_listen))
31 print(
'Starting intersect.')
32 ip_listen =
'127.0.0.1'
33 ip_send =
'192.168.0.146'
37 sk_listen =
listen(ip_listen, port_listen)
39 print(
"Waiting to receive data\n")
41 data = sk_listen.recvfrom(10000)[0]
42 data = data.decode(
'ascii')
45 idx = data.find(
"Payload=")
46 payload = data[idx+8:-1]
47 encoded = payload.encode(
'utf-8')
48 msgBytes = unhexlify(encoded)
51 send(msgBytes, ip_send, port_send)
53if __name__==
"__main__":
def listen(ip_listen, port_listen)
def send(msg, ip_send, port_send)