Results 1 to 4 of 4

Thread: VB6 question:

  1. #1
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,785

    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.’”

  2. #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

  3. #3
    Senior Member
    Join Date
    Oct 2001
    Posts
    638
    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.

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,785
    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
  •