Thanks for the quick response and I apologize for a lack of code and expertise.
My program hangs on the receive (pasted below), when I'm trying to connect
to a computer with the wrong IP or the computer is not responding due to a
mode that it is in. If I could I'd place a try catch to abort whatever
asynchronous runtime environment is going on regarding the net socket
udpclient, then that would be ideal. But a try catch doesn't work so I feel
I need to control the receive by binding it to a thread somehow.
To get to this udpclient send processing I'm instantiating another class
before it and passing variables from an event triggered from a windows form
application. I've got a coding example where I can sleep or abort a class
after binding it to a thread but this example is independent of passing
variables.
Function ReceiveTestBlock(ByVal inbuf As Byte()) As Boolean
Dim i As Integer
Dim newbyte As Byte
For i = 0 To inbuf.Length - 1
newbyte = inbuf(i)
If i = 3 Then
If newbyte = &HFBS Then
Return True
End If
End If
Next i
End Function
"Nicholas Paldino [.NET/C# MVP]" wrote:
Segue,
You will need to elaborate. From what I can tell, there is no
threading. I see a user-defined method (RecieveTestBlock), but who can tell
what is in it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"segue" <se***@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com... I'd like to control the threading for these lines of vb.net code:
udpClient.Send(bytcmd, bytcmd.Length, remoteEP) 'send recordset0
Dim InBuf As Byte() = {}
If InBuf.Length > 0 Then
If ReceiveTestBlock(InBuf) = True Then
Return True
End If
End If
udpClient.Close()
Any advice appreciated.
Regards;
Segue