08/03/09 19:54
Reiwarmir
Public Function rehost(ByVal nHost)
Dim hosts As System.Net.IPHostEntry
hosts = System.Net.Dns.GetHostEntry("ultimal2.no-ip.info")
MsgBox("ultimal2.no-ip.info")
Dim ip As System.Net.IPAddress
For Each ip In hosts.AddressList
Return ip
Next
End Function
mi restituisce un valore numerico
anche controllando con una messagebox contenente l'ip all'interno del ciclo for.
Ultima modifica effettuata da Reiwarmir 08/03/09 19:59
aaa
08/03/09 20:15
theprogrammer
Ma che senso ha il Return all'interno di un ciclo?
Il ciclo serve per restituire tutti gli eventuali IP.
Se l'Ip che deve restituire e' solo il primo, allora
Public Function rehost(ByVal nHost) As String
Dim hosts As System.Net.IPHostEntry
hosts = Dns.GetHostEntry(nHost)
Return hosts.AddressList(0).ToString()
End Function
Sub Main()
Console.WriteLine(rehost("ultimal2.no-ip.info"))
End Sub
Ultima modifica effettuata da theprogrammer 08/03/09 20:22
aaa
09/03/09 19:14
theprogrammer
Queste sono istruzioni riconosciute perche' e' attivo il namespace
Microsoft.VisualBasic
per la compatibilità con il VB6.
Dato che viene (purtroppo) automaticamente aggiunto quando un nuovo progetto viene creato, si possono usare quelle istruzioni.
Bisognerebbe eliminarlo.
aaa