Direct IP connection fix

This commit is contained in:
Vitaly Mikhailov 2020-07-10 19:50:33 +03:00
parent fae7349356
commit f23ed8caa6
No known key found for this signature in database
GPG Key ID: 46EFF05D37A3FA18
2 changed files with 17 additions and 12 deletions

View File

@ -53,12 +53,15 @@ Namespace Servers
Try
Dim connectIP As IPAddress = Nothing
For Each IPAddress In System.Net.Dns.GetHostEntry(Server.IP).AddressList
If IPAddress.AddressFamily = AddressFamily.InterNetwork Then
connectIP = IPAddress
Exit For
End If
Next
If Not IPAddress.TryParse(Server.IP, connectIP) Then
For Each IPAddress In Dns.GetHostEntry(Server.IP).AddressList
If IPAddress.AddressFamily = AddressFamily.InterNetwork Then
connectIP = IPAddress
Exit For
End If
Next
End If
Me._client.Connect(connectIP.ToString, CInt(Server.Port))

View File

@ -466,12 +466,14 @@ Public Class JoinServerScreen
Dim connectIP As IPAddress = Nothing
For Each ipaddress In System.Net.Dns.GetHostEntry(Me.IP).AddressList
If ipaddress.AddressFamily = AddressFamily.InterNetwork Then
connectIP = ipaddress
Exit For
End If
Next
If Not IPAddress.TryParse(IP, connectIP) Then
For Each ipaddress In Dns.GetHostEntry(IP).AddressList
If ipaddress.AddressFamily = AddressFamily.InterNetwork Then
connectIP = ipaddress
Exit For
End If
Next
End If
sw.Start()
client.Connect(connectIP, CInt(Me.Port))