|
-
Sep 20th, 2005, 04:55 AM
#1
Thread Starter
Addicted Member
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.
-
Sep 20th, 2005, 01:13 PM
#2
Member
Re: Winsock, how to check for connectivity
Well you can make a listbox in your server and add this:
VB Code:
Private Sub Winsock1_Connect()
list1.additem (Winsock1.RemoteHostIP)
End Sub
Private Sub Winsock1_Close()
list1.RemoveItem (Index)
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.......
-
Sep 20th, 2005, 03:27 PM
#3
Re: Winsock, how to check for connectivity
Best way is to do this,
VB Code:
If winsock(x).state = sckConnected then
msgbox("We are connected")
else
msgbox("We are not")
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|