Results 1 to 3 of 3

Thread: Winsock, how to check for connectivity (solved with Thanks)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    129

    Winsock, how to check for connectivity (solved with Thanks)

    i am trying to put in a check to see if the winsock has connected with the server. In trying to use the..

    winsock.state <> 7

    To check if it has a connection, according the help files 7 is Connected, but its reverting to this regardless of wether a conncetion is made or not, useing debug the winsock state for both connect and not is 6 which im not sure what that refers to.

    I wantto be able to check constantly if there is a connection between the 2 in case one side goes down.
    Last edited by fgp123; Sep 21st, 2005 at 05:08 AM.

  2. #2
    Member EnYcE's Avatar
    Join Date
    Sep 2005
    Posts
    33

    Re: Winsock, how to check for connectivity

    Well you can make a listbox in your server and add this:

    VB Code:
    1. Private Sub Winsock1_Connect()
    2. list1.additem (Winsock1.RemoteHostIP)
    3. End Sub
    4.  
    5. Private Sub Winsock1_Close()
    6. list1.RemoveItem (Index)
    7. End Sub

    Or course this is just an example. All this does is when the client connects to the server it adds the client's IP address to a listbox and when the client is closed the server removes the IP address from the listbox.

    NOTE: If you have multiple connections this won't work as good.......

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock, how to check for connectivity

    Best way is to do this,

    VB Code:
    1. If winsock(x).state = sckConnected then
    2.    msgbox("We are connected")
    3. else
    4.    msgbox("We are not")
    5. end if

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