CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Posts
    5

    what am I not seeing?

    Private Sub cmdConnect_Click()
    wsS(0).Close
    wsS(0).RemotePort = 600
    wsS(0).Connect ConnectTo.Text
    End Sub

    Private Sub Form_Load()
    If OpenAsServer = True Then
    'Do Server Stuff
    Frame1.Enabled = True
    Text1.Text = wsS(0).LocalIP

    Else
    'Do Client Stuff
    Frame2.Enabled = True
    wsC.Listen
    Text2.Text = wsC.LocalIP
    wsC.Close
    wsC.LocalPort = 600
    wsC.Listen
    End If
    End Sub


    Private Sub wsC_Connect()
    Text3.Text = wsC.RemoteHostIP
    End Sub

    Private Sub wsC_ConnectionRequest(ByVal requestID As Long)
    wsC.Accept requestID
    End Sub
    _______________________________________________

    One form acts as server and client. When one computer tries to connect to the other I get an error. I must be overlooking something.

    That is my code. I am getting this error:
    "Run-time error '40020': Invalid operation at current state"


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: what am I not seeing?

    change wsC.LocalPort = 600 to wsC.LocalPort = 0.

    HTH

    cksiow
    http://vblib.virtualave.net - share our codes



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

Featured