Solved

Wisock Refresh IP?

Posted on 2004-03-31
5
247 Views
Last Modified: 2013-11-13
Hello... I have Wisock report the IP address of the computer to Label1.caption on a timer event.
If the IP address changes (for instance from 127.0.0.1, which is what it is when i am not connected to the internet
to 192.168.0.102, which is what it is when I am connected to the network)... The Wisock component still reports my
address as 127.0.0.1....what is wrong??? here is my code:


Public Sub Timer1_Timer()

Label1.Caption = Winsock1.LocalIP

End Sub
0
Comment
Question by:udontlikethisstuff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Shauli
ID: 10728739
What is your timer interval? and is it enabled?

S
0
 

Author Comment

by:udontlikethisstuff
ID: 10728787
it is enabled.. i tested it with a msgbox command... every forty seconds it would display the same IP 127.0.0.1 (Unless I connected to the internet then ran the program)
0
 
LVL 4

Accepted Solution

by:
learning_t0_pr0gram earned 20 total points
ID: 10729631
try making it a control array with an index of 0 and doing it like this:

Private Sub Timer1_Timer()
Load Winsock1(1)
Label1.Caption = Winsock1(1).LocalIP
Unload Winsock1(1)
End Sub
0
 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 10729710
oh.. and the reason this works is because winsock gets ur ip when it is loaded, so without it, when u open ur program it gets the ip and stores it... but when u load a new one, it gets a new ip each time it is loaded...
0
 

Author Comment

by:udontlikethisstuff
ID: 10732148
Works Great! thanks a lot!...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question