@@ -256,10 +256,7 @@ private static NetworkEndpoint ParseNetworkEndpoint(string ip, ushort port, bool
256256 if ( ! NetworkEndpoint . TryParse ( ip , port , out endpoint , NetworkFamily . Ipv4 ) &&
257257 ! NetworkEndpoint . TryParse ( ip , port , out endpoint , NetworkFamily . Ipv6 ) )
258258 {
259- if ( ! silent )
260- {
261- Debug . LogError ( $ "Invalid network endpoint: { ip } :{ port } .") ;
262- }
259+ return default ;
263260 }
264261
265262 return endpoint ;
@@ -512,8 +509,15 @@ private bool ClientBindAndConnect()
512509 // Verify the endpoint is valid before proceeding
513510 if ( serverEndpoint . Family == NetworkFamily . Invalid )
514511 {
512+ #if HOSTNAME_RESOLUTION_AVAILABLE && UTP_TRANSPORT_2_4_ABOVE
513+ // If it's not valid, try to treat it like a URL.
514+ InitDriver ( ) ;
515+ m_Driver . Connect ( ConnectionData . Address , ConnectionData . Port ) ;
516+ return true ;
517+ #else
515518 Debug . LogError ( $ "Target server network address ({ ConnectionData . Address } ) is { nameof ( NetworkFamily . Invalid ) } !") ;
516519 return false ;
520+ #endif
517521 }
518522
519523 InitDriver ( ) ;
@@ -625,7 +629,7 @@ public void SetClientRelayData(string ipAddress, ushort port, byte[] allocationI
625629 /// <summary>
626630 /// Sets IP and Port information. This will be ignored if using the Unity Relay and you should call <see cref="SetRelayServerData"/>
627631 /// </summary>
628- /// <param name="ipv4Address">The remote IP address (despite the name, can be an IPv6 address)</param>
632+ /// <param name="ipv4Address">The remote IP address (despite the name, can be an IPv6 address or a domain name )</param>
629633 /// <param name="port">The remote port</param>
630634 /// <param name="listenAddress">The local listen address</param>
631635 public void SetConnectionData ( string ipv4Address , ushort port , string listenAddress = null )
0 commit comments