CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Posts
    1

    Refreshing winsock details

    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






  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Refreshing winsock details

    Try this

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




    Tom Cannaerts
    [email protected]

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured