Skip to content

Commit

Permalink
Merge pull request #48 from sei-jmattson/fix-multicast-dgram-reader
Browse files Browse the repository at this point in the history
apply multicast membership to specified interface
  • Loading branch information
ampledata authored Nov 28, 2023
2 parents bfbe3ff + a640d0f commit 11635f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pytak/client_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ async def create_udp_client(

# Create Multicast Reader
if is_multicast:
group = socket.inet_aton(host)
mreq = struct.pack("4sL", group, socket.INADDR_ANY)
ip = socket.INADDR_ANY if local_addr[0] is None else int(ipaddress.IPv4Address(local_addr[0]))
group = int(ipaddress.IPv4Address(host))
mreq = struct.pack("!LL", group, ip)

reader.socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
reader.socket.setsockopt(
Expand Down
5 changes: 2 additions & 3 deletions pytak/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
DEFAULT_COT_PORT: str = "8087"
DEFAULT_ATAK_PORT: str = "4242"
DEFAULT_BROADCAST_PORT: str = "6969"
DEFAULT_TAK_PROTO: str = "1"

DEFAULT_BACKOFF: str = "120"
DEFAULT_SLEEP: str = "5"
Expand Down Expand Up @@ -82,8 +81,8 @@
# issue. See: https://github.com/snstac/pytak/pull/22
DEFAULT_MIN_ASYNC_SLEEP: float = 0.1

# TAK Protocol to use for CoT output, one of: 0 (XML, default), 2 (Mesh), 2 (Stream).
DEFAULT_TAK_PROTO: str = "0"
# TAK Protocol to use for CoT output, one of: 0 (XML, default), 1 (Mesh/Stream).
DEFAULT_TAK_PROTO: str = "1"

# Python <3.8 has no way of including XML Declaration in ET.tostring():
DEFAULT_XML_DECLARATION: bytes = (
Expand Down

0 comments on commit 11635f0

Please sign in to comment.