Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Remoting / May 2008

Tip: Looking for answers? Try searching our database.

File transfer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rami - 27 May 2008 12:59 GMT
A beginner question-
Is remoting appropriate for file transfer of 2 mb files?
Regards

rami
Tommaso Caldarola - 27 May 2008 13:32 GMT
> A beginner question-
> Is remoting appropriate for file transfer of 2 mb files?
> Regards

I'm using Remoting to transfer of 500K chunk of bytes.

tomb
Kevin J. Stricklin - 27 May 2008 20:43 GMT
When transferring large quantities of data, consider using a Stream object.
The use of a Stream object will automatically break the data into smaller
chucks.

As an example, here's a simple Remoting object:

public class RemotingObject : MarshalByRefObject
{
    public Stream GetLargeAmountsOfData()
    {
        return new FileStream("c:\\Temp\\data.dat", FileMode.Open);
    }
}

Here's how a client might call and use this object to retrieve data in chunks.

public class Client
{
   public void GetRemotingData()
   {
       RemotingObject ro = Activator.GetObject(typeof(RemotingObject),
"tcp://localhost:1234/RO.rem");
       Stream s = ro.GetLargeAmountsOfData();

       byte[] data = new byte[1024 * 64];
       int bytesToRead = s.Length();
       while (bytesToRead > 0)
       {
           bytesToRead -= s.Read(data, 0, data.Length);
           //do something with the data
       }
   }
}

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.