Results 1 to 2 of 2

Thread: WinSock Connection Request Error!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67

    Exclamation

    When I use this code for a winsock connection request:
    Code:
    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    Winsock1.Accept requestID
    txtRecive.Text = txtRecive.Text & vbCrLf & "ChatX: Connection Request Detected."
    End Sub
    I get runtime error 40020:
    Invalid operation at current state

    when I hit debug it highlights that code snippet up there! HELP
    Frankie Weindel
    VB 6 Learning Edtion SP3

  2. #2
    Guest
    This will fix it:

    Code:
    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
        If Winsock1.State <> sckClosed Then Winsock1.Close
        Winsock1.Accept requestID
        txtRecive.Text = txtRecive.Text & vbCrLf & "ChatX: Connection Request Detected."
    End Sub
    Sunny

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