Results 1 to 2 of 2

Thread: Compile error: Invalid use of property -> for Load on a winsock control??? HELP!

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Posts
    1

    Compile error: Invalid use of property -> for Load on a winsock control??? HELP!

    Hello all,
    I have a winsock object on a form, and when I try to do a connection to it I get this error:

    Compile error: Invalid use of property

    The "Load" word is highlighted in this code:

    Private Sub tcpServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    If Index = 0 Then
    intMax = intMax + 1
    Load tcpServer(intMax)
    tcpServer(intMax).LocalPort = 0
    tcpServer(intMax).Accept requestID
    End If
    End Sub

    I have the Index set to zero.. What am I doing wrong?? This code for the handler can be found in MSDN Multiple Winsock connections help page... so I must be doing something else wrong that affects that Load statement!

    Thanks!

  2. #2
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Try not setting the port, I have my server accept connections like this...

    VB Code:
    1. 'CurSocs is a global integer of how many sockets are currently loaded
    2. Private Sub Winsock2_ConnectionRequest(ByVal requestID As Long)
    3. On Error Goto Error1
    4.     If Winsock2.RemoteHostIP = "127.0.0.1" Then Exit Sub ' To hell with the local host, I do not wanna talk to it.
    5.     Load Winsock(CurSocs) + 1
    6.     Winsock(ThisSoc).Accept requestID
    7.         CurSocs = CurSocs + 1
    8.  
    9. Exit Sub
    10.  
    11. Error1:
    12. Msgbox Err.Number & VbCrLf & Err.Description, VBCritical, "Error!"
    13.  
    14. End Sub

    As long as the port is set right on the first one in the array it should work for the rest, hell, mine does.

    Let me know if you have any more questions.
    Last edited by Spajeoly; Apr 14th, 2003 at 11:49 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