|
-
Nov 30th, 2009, 05:22 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Winsock Private IP problem
Hey Guys,
I've run into a problem that I don't know how to fix.
I have a program that grabs the private IP address for the computer using the Winsock control.
I have it check to see if it has changed and compare to what it was, etc..
Well, if the ip address changes via DHCP renewal, the program sees it just fine everytime it changes. But if I statically assign an IP address, the program only recognizes the change one time. Even though its the same code.
Here is the simplified version of what I'm doing
Code:
Private Sub Refresh_All()
If WS1.State <> sckClosed Then
WS1.Close
End If
strNewLocalIP = WS1.LocalIP
If strNewLocalIP <> strOldLocalIP Then
' do a few updates to database and send email (this works perfectly)
End If
WS1.Close
End Sub
Yes, thats the very simplified version and more or less pseudocode for what I'm doing.
This and the rest of the code are all stored in the Sub. I call the sub when the program loads, and then on a specified timer when it gets to 0. The user can set whether they want it to check on startup. But regardless whether they do or wait for the automatic refresh, it calls the same Sub.
But, if I statically assign the IP address, it only notices the change the first time it runs the sub. Every subsequent attempt doesn't do anything. It's like it doesn't recognize that it has changed.
So, if they have it set to check for changes on startup, when the program loads, it sees the change right away. But anytime it checks after that while its still running, it doesn't notice.
But, if they have it wait until the first refresh to check, it notices during the refresh, but not any other time after that.
I hope that makes enough sense to get the help I need 
Thanks in advance.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|