G
Gigi
Hello,
I have a byte array and i must send(to blocks) to remote class
In the remote class i write a file stream......
How?
In my sample i send stream...
Code CLIENT:
FSource = New FileStream("c:\test.tif", FileMode.Open)
While FSource.Position < FSource.Length - 1
Call RemoteObject.WriteStream(FSource)
End While
Code SERVER:
Public Sub WriteStream(ByVal SourceStream As Stream)
Dim FOutput As FileStream
If Not File.Exists("c:\testremote.tif") Then
FOutput = New FileStream("c:\testremote.tif", FileMode.CreateNew,
FileAccess.ReadWrite)
Else
FOutput = New FileStream("c:\testremote.tif", FileMode.Append,
FileAccess.Write)
End If
Dim BWriter As BinaryWriter = New BinaryWriter(FOutput)
Dim i As Integer
Dim intBytesRead As Integer
Const intSize As Integer = 4096
Dim bytes(intSize) As Byte
intBytesRead = SourceStream.Read(bytes, 0, intSize)
BWriter.Write(bytes, 0, intBytesRead)
BWriter.Close()
FOutput.Close()
End Sub
I have a byte array and i must send(to blocks) to remote class
In the remote class i write a file stream......
How?
In my sample i send stream...
Code CLIENT:
FSource = New FileStream("c:\test.tif", FileMode.Open)
While FSource.Position < FSource.Length - 1
Call RemoteObject.WriteStream(FSource)
End While
Code SERVER:
Public Sub WriteStream(ByVal SourceStream As Stream)
Dim FOutput As FileStream
If Not File.Exists("c:\testremote.tif") Then
FOutput = New FileStream("c:\testremote.tif", FileMode.CreateNew,
FileAccess.ReadWrite)
Else
FOutput = New FileStream("c:\testremote.tif", FileMode.Append,
FileAccess.Write)
End If
Dim BWriter As BinaryWriter = New BinaryWriter(FOutput)
Dim i As Integer
Dim intBytesRead As Integer
Const intSize As Integer = 4096
Dim bytes(intSize) As Byte
intBytesRead = SourceStream.Read(bytes, 0, intSize)
BWriter.Write(bytes, 0, intBytesRead)
BWriter.Close()
FOutput.Close()
End Sub