Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:58:46+00:00 2026-06-08T15:58:46+00:00

I have a .NET Remoting application. Currently the application has functionality in which Remoting

  • 0

I have a .NET Remoting application.
Currently the application has functionality in which Remoting Server is required to fetch the file and send it to client as byte array. As the whole byte array is going to client at once, if the file size is big, then there is problem.

So I am thinking of implementing partial reading of the file,

like

public byte[] ReadPartialFile(string fileName, int offset, int bufferSize)
{
   //use FileStream and BinaryReader to read the required (depends of offset and buffer) bytes and send them back...
}

But I am afraid that if file is large and buffer size small, the FileStream and related objects would be created and disposed of N number of times, which can adversely impact the application….

I also don’t want to spike application’s (client & server) memory consumption…

Anyone got better ideas…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:58:48+00:00Added an answer on June 8, 2026 at 3:58 pm

    Since Stream is MarshalBy Ref you can pass a stream from client to the server

    public unsafe void ReadFileFromSensor(Stream destination)
    {
         //server writes to stream
         destination.Write(buffer, 0, buffer.Length);
    }
    

    The other way round will not work. If you read from a stream over remoting, the passed array will be serialized and will therefore not be filled.

    In this case we have defined an extension method for stream without the need to pass an array

    public static byte[] Read(this Stream stream, int nBytesToRead, out  int nBytesRead)
    {
            byte[] buffer = new byte[nBytesToRead];
            nBytesRead = stream.Read(buffer,0,nBytesToRead);
            return buffer;
    }
    

    We use this method to communicate over local Ethernet. There it is not a problem for the server to access the stream on the client. But it may be a problem in other scenarios if the server have to connect back to the client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a client-server application which uses .NET Remoting communication. For authentication reasons i
I am writing a .NET Remoting application. I have my dll, server, and client
I have an ASP.Net web application, which interacts with .Net Remoting application server. As
I have a client-server application that uses .net remoting. The clients are in a
I have a client/server application that communicates with .Net remoting. I need my clients
I have a server-side code using .NET Remoting to establish the connection with client.
I have what I thought was a simple .NET Remoting Client/Server (Code Below)... When
I have a large application written using .Net remoting for file transfer. This was
I have a VB.NET application with a connection to an SQL Server 2003. On
I have a .NET 2.0 remoting application that needs to communicate between machines that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.