for example like this dummy code :
Public Sub DoTask1
asyncsend("xxxxx")
wait for asyncreceive
asyncsend("yyyyy")
End Sub
Private Sub async_NewData (Buffer() As Byte)
dim cmd as string = BytesToString(Buffer,0,Buffer.length,"UTF8")
if cmd = "abc" then callsub(Me,"asyncreceive")
End Sub
what happened if async_NewData is never arrive, or arrive with data I dont want. Then "wait for asyncreceive" will wait there, and never continue, right ?
If i need to wait this reply maximumly xx seconds, if not receive then something wrong happened, ... how to do it ?
Of course maybe a timer can be created to trigger timeout, but then how I can destroy that "wait for" ?