WSL2 networking mirrored - multicast support (Windows host <> WSL distro)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
**Is your feature request related to a problem? Please describe.**
Theorically, the documentation for WSL2 mirrored says that Multicast support is already in place, but there's a lof of issues linked to this:
#10735
#12122
#11966
#10614
I have faced myself this frustating problem through my company with a ROS2 app: Windows <> WSL2.
The default NAT mode is not a solution because it has other strange problem explained in https://github.com/microsoft/WSL/issues/11966
**Describe the solution you'd like**
Multicast works in Mirrored mode between Windows and WSL Distro.
**Describe alternatives you've considered**
**Additional context**
The basic example I've been using to do quick test of multicast sender/receiver:
**sender**
```python
import socket
import struct
import time
MULTICAST_GROUP = '224.1.1.1' # Change to your desired multicast address
PORT = 5004 # Change to your desired port
# Create the socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
# Set the socket option to allow multicast
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
# Send multicast packets
while True:
message = b'This is a multicast message'
sock.sendto(message, (MULTICAST_GROUP, PORT))
print(f'Sent: {message}')
time.sleep(1) # Send a packet every second
```
**receiver**
```python
import socket
import struct
MULTICAST_GROUP = '224.1.1.1' # Match the address used in the sender
PORT = 5004 # Match the port used in the sender
# Create the socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('', PORT))
# Tell the operating system to add the socket to the multicast group
group = socket.inet_aton(MULTICAST_GROUP)
mreq = struct.pack('4sL', group, socket.INADDR_ANY)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
print(f'Ready to receive on {MULTICAST_GROUP}:{PORT}')
# Receive multicast packets
while True:
data, addr = sock.recvfrom(1024) # Buffer size is 1024 bytes
print(f'Received message: {data} from {addr}')
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported behavior with the Python multicast sender and receiver in mirrored mode, then compare it with the linked issues #10735, #12122, #11966, and #10614. Done means multicast packets pass between the Windows host and the WSL distro as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- networking, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100