Hello anthony.
No I didn't come up with a better solution then this by now. Though, I've got some basic ideas how to bypass this...but none seems to be a really good idea to me. One was to build somekind of Timout-Loop into the function:
Code:
Dim buffer(Me.prv_client.ReceiveBufferSize - 1) As Byte
Dim read As Integer = Int32.MaxValue
Dim timeOut As Integer = 0
Do
Try
read = Me.prv_strm.Read(buffer, 0, buffer.Length)
Catch ex As IOException
read = 0
End Try
'Do something with it
While timeOut < 256 And Not Me.prv.strm.DataAvailable
timeout += 1
End While
timeOut = 0
Loop While Me.prv_strm.DataAvailable
This seems to be some way, but it is also a waste like Sleep() in my eyes...also I can't shake the feeling that the problem is not ours, but that of the Framework. The MSDN is full of examples which runs exactly into this issue, which tells me that even the MS people didn't expect this problem.
But you brought me on the idea to have a look at these classes in the Reflector...maybe I can find a solution down there. Though, I ask myself if the same issue exists within Mono, I'll try that one out tomorrow.
Bobby