I'm trying to create a simple server application that will accept incoming data from a client application. I'm trying to do what the examples say to do on pp 174-176 of the VB Components Tool Guide (using the Winsock Control). I need to be able to accept more than 1 connection request at a time, so I'm trying to create a control array as follows...
Private intMax As Long
Private Sub Form_Load()
intMax = 0
tcpServer(0).LocalPort = 2345
Private Sub tcpServer_ConnectionRequest _
(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
tcpServer(intMax).LocalPort = 0
...so far so good. I've followed instructions by setting the index property of tcpServer to 0 which supposedly creates the array. I also did likewise with txtData. I'm not sure if txtData is supposed to display the incoming data from the client, but I'm assuming it is. The instructions don't say.
Now I complete the scenario by including the event procedure for the arrival of the data...
Private Sub tcpServer(intMax)_DataArrival(ByVal bytesTotal As Long)
' Declare a variable for the incoming data.
' Invoke the GetData method and set the Text
' property of a TextBox named txtOutput to
' the data.
Dim strData As String
txtData(intMax).Text = strData
...and I get a compiler error saying that the underscore in the procedure declaration is an invalid character. ((inMax)_DataArrival). If this is invalid then why is it not also invalid in scalar context...
Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long) ???
...If I leave out the (intMax), I get an error that states that the Procedure declaration does not match the description of event or procedure having the same name. How should I handle this?