Skip to content

Commit a9f3c80

Browse files
committed
connection test
1 parent 4f757a7 commit a9f3c80

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

com.unity.netcode.gameobjects/Tests/Runtime/Transports/UnityTransportConnectionTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ public IEnumerator ConnectSingleClient_Hostname()
164164
Assert.AreNotEqual(NetworkFamily.Invalid, endpoint.Family,
165165
"Timed out waiting for localhost hostname resolution to complete.");
166166

167-
m_Server.SetConnectionData(endpoint.Address, 7777, endpoint.Address);
167+
// Use the wildcard listen address for the resolved address family. This handles
168+
// cases where "localhost" resolves to a non-loopback address (e.g. a device's LAN
169+
// IP on some Android versions) and avoids relying on the exact IP in the local
170+
// endpoint (which may be a wildcard 0.0.0.0 when UTP binds before routing).
171+
var listenAddress = endpoint.Family == NetworkFamily.Ipv6 ? "::" : "0.0.0.0";
172+
m_Server.SetConnectionData(listenAddress, 7777, listenAddress);
168173
m_Server.StartServer();
169174

170175
yield return WaitForNetworkEvent(NetworkEvent.Connect, m_ClientsEvents[0]);

0 commit comments

Comments
 (0)