Stop instant thread

yo3gwm

New member
Joined
Oct 9, 2009
Messages
4
Programming Experience
3-5
HELLO

How is possible to stop instant thread ?

Public Function TX_test(ByVal COMMAND As String) As String
Dim valBOOL As Boolean
Dim msg1 As String
Try
SIR_PRIMIT = ""
valBOOL = False
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(COMMAND)
COMUNICATIEudp.Ttl = timpOUT
COMUNICATIEudp.Send(sendBytes, sendBytes.Length)
ThreadRX = New Thread(AddressOf RX_UDP_test)
ThreadRX.Start()
valBOOL = ThreadRX.Join(timpOUT)
If valBOOL = True Then
Return SIR_PRIMIT
Else
Return "TIME OUT"
End If

HERE I NEED TO STOP INSTANT THANK's
'ThreadRX.Abort()
'Thread.Sleep(0)
ThreadRX = Nothing
Catch ex As Exception
msg1 = "TX_TEST" & Chr(13) & Chr(10) & ex.Message
MsgBox(msg1, MsgBoxStyle.Critical, "YO3GWM 15.09.2009")
Return "ERR"
End Try
End Function
'aici se primeste raspuns (fir adresa catre aceasta rutina)
Sub RX_UDP_test()
Dim msg1 As String
Try
Dim receiveBytes As [Byte]() = COMUNICATIEudp.Receive(IPPLC)
SIR_PRIMIT = Encoding.ASCII.GetChars(receiveBytes)
Catch ex As Exception
msg1 = "RX_TEST" & Chr(13) & Chr(10) & ex.Message
MsgBox(msg1, MsgBoxStyle.Critical, "YO3GWM 15.09.2009")
End Try
End Sub
 
Back
Top