Results 1 to 2 of 2

Thread: winsock

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88

    Angry

    i keep getting an error 40020 invalid operation at current state. its a chat program i'm making but i'm just need to get it to connect first. Please help me out asap!!!!


    heres the code

    client:
    Option Explicit

    Private Sub cmdConnect_Click()
    On Error Resume Next
    sock.Connect txtIP, txtPort
    End Sub

    Private Sub cmdDisconnect_Click()
    sock.Close
    End Sub

    Private Sub sock_Connect()
    MsgBox "hi", vbOKOnly, "hi"
    End Sub


    server:
    Option Explicit

    Private Sub Form_Load()

    If sock.State <> sckClosed Then
    sock.Close
    End If
    sock.Listen
    End Sub

    Private Sub sock_Connect()
    MsgBox "hi", vbOKOnly, "hi"
    End Sub

    Private Sub sock_ConnectionRequest(ByVal requestID As Long)

    sock.Accept requestID
    End Sub

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    are you getting the error in the server or client?

    If its in the client this might be it. I have never connected the way you have. Just try it like this(your way is probably correct but just in case...)
    Code:
    'your way
    'On Error Resume Next 
    'sock.Connect txtIP, txtPort 
    
    'try this
    sock.remotehost = txtip.text ' maybe its because you didn't add .text?
    sock.remoteport = txtport.text
    sock.connect
    Good luck!
    By the way, I have a winsock demo on my site... http://www.stevescyberhome.net

    [Edited by SteveCRM on 09-11-2000 at 09:28 PM]

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