[Mono-devel-list] NetworkStream
Arnhoffer Károly
karnhoffer at ecron.hu
Wed Jul 20 03:22:42 EDT 2005
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
More information about the Mono-devel-list
mailing list