>> Comment repasser le trd1 en RUNNING et trd2 en UNSTARTED (A part couper la tâche ;o))
Vérifie l'état de tes threads si ils ne sont pas suspendus ou en cours d'execution puis redéfinit une nouvelle instance du thread que tu as à "relancer".
Ce n'est pas un nouveau thread, c'est un thread trd1 existant qui est en statut "Stopped"...
Que je souhaite passer en "Running"...
Private trd1 As New Thread(AddressOf ThreadConn)
Private trd2 As New Thread(AddressOf ThreadData)
Dim Thrdata As [String] = Nothing
Dim Thrconn As [String] = Nothing
Load de la form
trd1.Start()
Sub ThreadConn()
If TcpServer.Pending <> True Then
tcpClientConnect = TcpServer.AcceptTcpClient
Try
stream = tcpClientConnect.GetStream()
trd2.Start()
Catch ex As Exception
End Try
End If
Sub ThreadData()
.....
Voici le cycle :
Au démarrage = trd1 est RUNNING, trd2 est UNSTARTED
Action utilisateur (Connexion TELNET) = trd1 est STOPPED, trd2 est RUNNING
Comment repasser le trd1 en RUNNING et trd2 en UNSTARTED (A part couper la tâche ;o))