Nate Bross
Well-known member
I have a class that has a "RecievedData" event, this event returns the data that was recieved from a TCP Client. I would like to make a Collection of these classes and handle the RecievedData event.
What do I need to so I can handle events from the clsClient within the Collection?
Code:
Public WithEvents cClient As clsClient
Public Clients As New Collection
Public Sub TCPListen()
Randomize()
Do Until bRunning = False
tcpListener.Start()
Accept the pending client connection and return
a TcpClient initialized for communication.
Dim tcpClient As TcpClient
Dim TheKeyID As String = Rnd(300).ToString
cClient = New clsClient(tcpListener.AcceptTcpClient(), TheKeyID)
Clients.Add(cClient, TheKeyID)
Loop
tcpListener.Stop()
End Sub
What do I need to so I can handle events from the clsClient within the Collection?