"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
Brett,
Can you show the code in that event?
(First copied in a notebook, than pasted back in a message otherwise it is
almost unreadable)
Cor
Here is the timer tick event code. This is the only place timer is being
disabled/enabled. The interval is set at 200. Thanks.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim CurThreadStart As ThreadStart
Dim CurThread As Thread
Dim ThreadCount As Integer
Dim MaxThreads As Integer = 5
Dim i As Integer
Try
If Not tcpListener.Pending() Then
Exit Sub
End If
Timer1.Enabled = False
If ActiveThreads > CInt(MaxThreads) Then
Timer1.Enabled = True
Exit Sub
End If
CurThreadStart = New ThreadStart(AddressOf Listen)
CurThread = New Thread(CurThreadStart)
CurThread.IsBackground = True
CurThread.Start()
SyncLock CurThread
ActiveThreads += 1
'write to log file
utility.WriteToFile(CurrentDirectory.GetCurrentDir ectory,
LogFileExec, utility.CurrentDateTime(0) & " - ActiveThreads = " &
ActiveThreads)
End SyncLock
Timer1.Enabled = True
Catch ex As Exception
If InStr(ex.Message, "Not listening") Then
'write to log file
utility.WriteToFile(CurrentDirectory.GetCurrentDir ectory,
LogFileError, utility.CurrentDateTime(0) & " - ERROR [Timer1_Tick] " &
ex.Message & vbCrLf)
Else
End If
End Try
End Sub