Skip to content

Commit

Permalink
Merge pull request #531 from bontebok/master
Browse files Browse the repository at this point in the history
Use local IPv6 address when masterServerEndPoint is an IPv6 address
  • Loading branch information
RevenantX authored Sep 25, 2023
2 parents 7c38d4c + 13dfecd commit 88f1fdb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion LiteNetLib/NatPunchModule.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Concurrent;
using System.Net;
using System.Net.Sockets;
using LiteNetLib.Utils;

namespace LiteNetLib
Expand Down Expand Up @@ -173,7 +174,7 @@ public void SendNatIntroduceRequest(IPEndPoint masterServerEndPoint, string addi
{
//prepare outgoing data
string networkIp = NetUtils.GetLocalIp(LocalAddrType.IPv4);
if (string.IsNullOrEmpty(networkIp))
if (string.IsNullOrEmpty(networkIp) || masterServerEndPoint.AddressFamily == AddressFamily.InterNetworkV6)
{
networkIp = NetUtils.GetLocalIp(LocalAddrType.IPv6);
}
Expand Down

0 comments on commit 88f1fdb

Please sign in to comment.