|
-
Apr 14th, 2003, 07:45 PM
#1
Thread Starter
New Member
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!
-
Apr 14th, 2003, 11:44 PM
#2
Frenzied Member
Try not setting the port, I have my server accept connections like this...
VB Code:
'CurSocs is a global integer of how many sockets are currently loaded
Private Sub Winsock2_ConnectionRequest(ByVal requestID As Long)
On Error Goto Error1
If Winsock2.RemoteHostIP = "127.0.0.1" Then Exit Sub ' To hell with the local host, I do not wanna talk to it.
Load Winsock(CurSocs) + 1
Winsock(ThisSoc).Accept requestID
CurSocs = CurSocs + 1
Exit Sub
Error1:
Msgbox Err.Number & VbCrLf & Err.Description, VBCritical, "Error!"
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|