|
-
Sep 14th, 2000, 05:24 AM
#1
Thread Starter
Addicted Member
Hi
I have developed a winsock application.
Everything is working fine except for client disconnections.
If a client program is closed, the Winsock Close event occurs on the server program.
However, if windows crashes, or the client computer is just turned off, the close event does not occur. How can I get it to occur?
Also, what is a good way of checking if a connection exists, even if the close event hasn't happened?
My program uses a control array so that multiple clients can connect at the same time.
Thanks.
-
Sep 14th, 2000, 06:33 AM
#2
Hyperactive Member
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Sep 14th, 2000, 06:51 AM
#3
Thread Starter
Addicted Member
Thanks for replying...
...but what if network traffic causes the ping response to be delayed, and then my program boots them off.
Is there no other way to do it?
-
Sep 14th, 2000, 07:00 AM
#4
Hyperactive Member
Server sends a string .
Client recieves string and sends back to server .
The server recieves a response and know client is still logged in .
Server waits 30 secs and does it again .
Thats the only thing I Can Think of .
or use winsock(index).state to see what state it's in
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Sep 14th, 2000, 08:10 AM
#5
Hyperactive Member
Try the code below to determine the connection state, but i didnt check it on the internet, just used it over LAN and it worked fine.
Code:
Private Sub Timer1_Timer()
If Winsock1.State = sckConnected Then
Label1.Caption = "Connected"
Else
Label1.Caption = "Disconnected"
End
End Sub
I dont think the close event will trigger if the computer is switched off directly, or if windows crashes, however if the user shutsdown windows properly, you might be able to use the following code.
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Winsock1.Close
End Sub
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
|