Skip to content

Commit

Permalink
ipv6 multicast
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Sep 24, 2024
1 parent 14308d3 commit 5b977c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion test/UniNetty.Transport.Tests/Channel/Sockets/NetUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ namespace UniNetty.Transport.Tests.Channel.Sockets
using UniNetty.Transport.Channels;
using UniNetty.Transport.Channels.Sockets;

static class NetUtil
public static class NetUtil
{
public static readonly IPAddress MULTICAST_IPV4 = IPAddress.Parse("230.0.0.1");
public static readonly IPAddress MULTICAST_IPV6_LINKLOCAL = IPAddress.Parse("FF02::1");
public static readonly IPAddress MULTICAST_IPV6_SITELOCAL = IPAddress.Parse("FF05::1");

internal static readonly AddressFamily[] AddressFamilyTypes =
{
AddressFamily.InterNetwork,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ public void Multicast(AddressFamily addressFamily, IByteBufferAllocator allocato
clientChannel = (SocketDatagramChannel)task.Result;

IPAddress multicastAddress = addressFamily == AddressFamily.InterNetwork
? IPAddress.Parse("230.0.0.1")
: IPAddress.Parse("ff12::1");
? NetUtil.MULTICAST_IPV4
: NetUtil.MULTICAST_IPV6_SITELOCAL;

var groupAddress = new IPEndPoint(multicastAddress, serverEndPoint.Port);
Task joinTask = serverChannel.JoinGroup(groupAddress);
Assert.True(joinTask.Wait(TimeSpan.FromMilliseconds(DefaultTimeOutInMilliseconds * 5)),
Expand Down

0 comments on commit 5b977c8

Please sign in to comment.