Did you compile with VS.NET/vbc in Windows, or is compiling with mbas in Linux?

If so, mbas currently doesn't automatically initializes local
variables as vbc seems to do so you need to be explicit:

                  Dim llogReadEverything As Boolean = false

Hope it helps,

:|

On 7/20/05, Arnhoffer Károly <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> If I do not do the "While Not llogReadEverything" loop, it reads the data.
> 
>         Private Function ReadData(ByRef tobjNetStream As  NetworkStream, 
> ByRef tbytBuffer As Byte(), ByVal tintFullSize As  Integer) As Boolean
>                  Dim lintSize As Integer = 0
>                  Dim llogReadEverything As Boolean
>                  Dim lintCounter As Integer
> 
>                  ReDim tbytBuffer(tintFullSize - 1)
> 
>                  While Not tobjNetStream.DataAvailable
>                            Thread.CurrentThread.Sleep(50)
>                  End While
> 
>                  lintSize += tobjNetStream.Read(tbytBuffer, 0, tintFullSize)
> 
>                  Return True
>          End Function
> 
> Do not understand the reason why. :)
> 
> Arnhoffer Károly
> ----------------------------------------
> eCron Informatika Kft.
> 1119 Budapest, Hadak útja 9.
> 
> tel./fax: +36 (1) 203-1535
> mobil:   +36 (30) 472-8855
> e-mail:  [EMAIL PROTECTED]
> 
> 
> 
> -----Original Message-----
> From: Martin Hinks [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 20, 2005 10:59 AM
> To: Arnhoffer Károly
> Cc: mono-devel-list@lists.ximian.com
> Subject: Re: [Mono-devel-list] NetworkStream
> 
> 
> Hi Arnhoffer,
> 
> There are various things to try:
> 
> 1.) Check that tIntFullSize is not 0 when the .Read line is called.
> 2.) Try this with a plain networkstream derived from a socket rather than 
> from a TcpClient
> 3.) If you are trying to read the entire buffer of length tintFullSize, is it 
> not possible that the server has not sent all the data when the read is 
> performed? ie. Just because DataAvailable is true does NOT mean that you may 
> be able to read ALL the data you are expecting from the stream, it might not 
> have arrived yet, and as you are expecting to be able to read it all it might 
> return 0 (I think it should block though, which is why it must work on .NET)
> 4.) After some of the diagnoses above, file a bugzilla report.
> 
> Martin
> 
> On 7/20/05, Arnhoffer Károly <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I have a server service created by Visual Studio .Net. It is using
> > System.Net.Sockets.TcpClient.GetStream to get a stream to communicate
> > on the network. When I run this service on a Windows machine (MS .NET
> > framework) everything is fine, but when running on a Linux machine
> > (SuSE 9.2, Mono 1.1.8 (from RPMs)) the service reads allways zeroes
> > from the stream.
> >
> > Example:
> >
> >         Private Function ReadData(ByRef tobjNetStream As
> > NetworkStream, ByRef tbytBuffer As Byte(), ByVal tintFullSize As
> > Integer) As Boolean
> >
> >                 Dim lintSize As Integer = 0
> >                 Dim llogReadEverything As Boolean
> >                 Dim lintCounter As Integer
> >
> >                 ReDim tbytBuffer(tintFullSize - 1)
> >
> >                 While Not llogReadEverything
> >                         While Not tobjNetStream.DataAvailable
> >                                 Thread.CurrentThread.Sleep(50)
> >                         End While
> >
> >                         lintSize += tobjNetStream.Read(tbytBuffer, 0, 
> > tintFullSize)
> >                         If lintSize >= tintFullSize Then
> >                                 llogReadEverything = True
> >                         End If
> >                 End While
> >
> >
> >                 Return True
> >         End Function
> >
> > A function like this gets zeroes from the stream when nonzero data was
> > sent.
> >
> >
> > Thanks!
> > Arnhoffer Károly _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> 
> 
> --
> Martin Hinks
> http://www.m-s-d.net
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 


-- 
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to