I am using this code below to monitor a tcp socket and process requests:
Do While Not m_stopRequested
sock = m_listenSock.AcceptNextConnection(1000)
If (Not (sock Is Nothing)) Then
t = New Thread(AddressOf Me.HandleClient)
m_numActiveThreads = m_numActiveThreads + 1
t.Start(sock)
End If
Loop
When it creates a new thread and using Me.HandleClient, which is just a SUB in the same code, is this OK to do or should I create a separate class on its own? I guess the real question is, when the new thread is created, do it make a whole different memory space for each thread?
Thanks