How to send whole file between server's and client's side?

S

schnitzell

Hi,

I need to send file between Client and Service.
How to do it?
For example:
I imagine that I should make public method (on the server side)
returning sometning like StreamReader object,
and on the client side I should to call this method.

Is it good way?

Thanks.
Greetings.
 
M

Michael Nemtsev

Hello schnitzell,

U should return array of bytes.

For example the server side code

using System.IO;

{
public byte[] Contents;
public string FilePath = @"c:\1.exe";

Stream s = File.Open(FilePath, FileMode.Open);
Contents = new byte[s.Length];
s.Read(Contents, 0, (int) s.Lenght);
s.Close();
// add support of getting file properties)
...
return Contents;
}

On the client perform vice versa operations, create File and write data from
Contents variable

s> I need to send file between Client and Service.
s> How to do it?
s> For example:
s> I imagine that I should make public method (on the server side)
s> returning sometning like StreamReader object,
s> and on the client side I should to call this method.
s> Is it good way?
s>
s> Thanks.
s> Greetings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top