From d23bb086ddf1e2ef00cda929ebea98b2b6337315 Mon Sep 17 00:00:00 2001 From: eichhornchen Date: Sat, 9 Jan 2021 21:26:29 +0100 Subject: [PATCH] Cleaned the repo --- for_testing_multicast/peer.py | 28 ---------------------------- for_testing_multicast/sender.py | 15 --------------- 2 files changed, 43 deletions(-) delete mode 100644 for_testing_multicast/peer.py delete mode 100644 for_testing_multicast/sender.py diff --git a/for_testing_multicast/peer.py b/for_testing_multicast/peer.py deleted file mode 100644 index 47622c9..0000000 --- a/for_testing_multicast/peer.py +++ /dev/null @@ -1,28 +0,0 @@ -from typing import Any, Tuple, Generator -from ipaddress import IPv6Address -import re -import socket -import time -import struct - -# Initialise socket for IPv6 datagrams -sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, socket.IPPROTO_UDP) - -# Allows address to be reused -sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - -# Binds to all interfaces on the given port -sock.bind(('', 1212)) - -# Allow messages from this socket to loop back for development -#sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_LOOP, True) - -# Construct message for joining multicast group -#mreq = struct.pack("16s15s".encode('utf-8'), socket.inet_pton(socket.AF_INET6, "ff02::4242:4242"), (chr(0) * 16).encode('utf-8')) - -mreq = struct.pack("16s15s", socket.inet_pton(socket.AF_INET6, "ff02::4242:4242"), bytes(socket.INADDR_ANY)) -sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_JOIN_GROUP, mreq) - -data, addr = sock.recvfrom(1024) -print(data) -print(addr[0], addr[1]) diff --git a/for_testing_multicast/sender.py b/for_testing_multicast/sender.py deleted file mode 100644 index 54f2ba2..0000000 --- a/for_testing_multicast/sender.py +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Any, Tuple, Generator -from ipaddress import IPv6Address -import re -import socket -import time -import struct - -# Initialise socket for IPv6 datagrams -sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, socket.IPPROTO_UDP) - -sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) - -sock.sendto("hello world".encode('utf-8'), ("ff02::4242:4242", 1212)) - -