Click to See Complete Forum and Search --> : Refreshing winsock details


tim7272
September 13th, 2001, 02:53 PM
Hi,

I'm successfully using winsock in a small/simple application to get ip details and computer name. However, should the ip details change whilst the application is open, and I try to get the details again, the original ip is given instead of the new ip details. The following is the code I'm using (as you can see, small/simple!)
Is there any code I can add to refresh the ip details?
Thanks in advance.

private Sub Command1_Click()
Call GetDetails
End Sub

private Sub Command2_Click()
Unload me
End Sub

private Function GetDetails()
Text1.Text = Winsock1.LocalIP
Text2.Text = Winsock1.LocalHostName
End Function

Cakkie
September 13th, 2001, 04:24 PM
Try this

private Function GetDetails()
Winsock1.Close
Winsock1.Bind
Text1.Text = Winsock1.LocalIP
Text2.Text = Winsock1.LocalHostName
End Function




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook