-
May 12th, 2002, 09:55 PM
#1
VB6 question:
I have a bug in a project.using mswinsck.ocx. when I make a connection to a server everything is fine, but when I type ‘bye’ or ‘quit’ to end the session on the server, my project still says connected and if I attempt to send another command before I ‘reset ‘ the app and set the value in the‘connection ‘ property of the ocx to false, it throws out a ‘wrong protocol or connection state ‘ error and crashes.
Does anyone know how I could check for a connection and reset the connection state property of this ocx to zero, before the data attempts to send? it checks this property before it sends now.
Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”
-
May 12th, 2002, 11:26 PM
#2
I'm assuming your using winsock control in vb6 so maybe if your using winsock make a command button like this. Or do a if statement. So if it sees a "Bye" in your text box it will do a winsock1.close. That's my guess really quick and dirty.
Private Sub Command1_Click()
Winsock1.Close
End Sub
Check out www.vbip.com I think they have the answer in one of there tutorials
-
May 12th, 2002, 11:27 PM
#3
Is this the kind of thing you're looking for?
Code:
Private Sub clWinsuck_Close()
If stateConnected = True Then
If clWinsuck.State = sckClosing Then
clWinsuck.Close
stateConnected = False
End If
End If
End Sub
OpenBSD - The proactively secure operating system.
-
May 13th, 2002, 03:42 AM
#4
Thanks for your input. while searching vbip and trying to rewrite smirc's code this came to me.
So far it seems to work.
If sckTterm.State = 7 Then
sckTterm.SendData txtCommand.Text + vbNewLine
else
yada
yada
yada
End If
Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”
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
|
|