View Single Post
  #5 (permalink)  
Old 09-03-2009, 3:49 PM
Robert_Zenz's Avatar
Robert_Zenz Robert_Zenz is offline
VB.NET Forum Idol
.NET Framework: .NET 2.0
 
Join Date: Jun 2008
Location: Vienna, Austria
Age: 22
Posts: 503
Reputation: 290
Robert_Zenz master of VB.NETRobert_Zenz master of VB.NETRobert_Zenz master of VB.NETRobert_Zenz master of VB.NETRobert_Zenz master of VB.NETRobert_Zenz master of VB.NETRobert_Zenz master of VB.NETRobert_Zenz master of VB.NETRobert_Zenz master of VB.NET
Default

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
__________________
Don't give TypeCasting Errors a chance, turn ON Option Strict!
Greatest Obfuscator ever: EazFuscator (Freeware)
Greatest Reflection Tool ever: .NET Reflector (Freeware) with Add-Ins
Greatest Introspection Tool ever: Gendarme (GPL)
Greatest MySQL FrontEnd ever: MySQL-Front (Shareware), HeidiSQL (GPL)
Reply With Quote