Dns.GetHostEntry(ServerTextBox.Text)
을 수행하기 위해 ip를 전달하면 완전히 잘못된 IP가 반환됩니다. 이 IP를 사용하여 내 서버에 연결할 때 "서버가 적극적으로 거부 한 연결"이라는 메시지와 함께 실패합니다.DNS.GetHostEntry가 잘못된 정보를 제공합니다
이 방법은 IP를받습니다 : ###. ###. ##. 119하지만 serverAddress를 다시 ###. ###. ##. 56으로 제공합니다. AddressList에서 .56 인 하나의 ip 만 보입니다.
_ServerAddress = Nothing
Dim remoteHost As IPHostEntry = Dns.GetHostEntry(ServerTextBox.Text)
If remoteHost IsNot Nothing AndAlso remoteHost.AddressList.Length > 0 Then
For Each deltaAddress As IPAddress In remoteHost.AddressList
If deltaAddress.AddressFamily = AddressFamily.InterNetwork Then
_ServerAddress = deltaAddress
Exit For
End If
Next
End If
잘못된 ip로 인해 다음 코드는 예외를 throw합니다. 연결을 만들기 위해 여기서 다시 ip로 하드 코드를 작성해야했습니다.
'hard coded ip
_ServerAddress = System.Net.IPAddress.Parse("###.###.##.119")
_Connection = New ConnectionInfo(_ServerAddress, CInt(PortTextBox.Text), AddressOf InvokeAppendOutput)
무엇이 여기에 있습니까?
흠. 청취 코드를 들여다 봅니다. –