Solved

Determining the size of transfer of a remote object

Posted on 2004-08-21
3
194 Views
Last Modified: 2010-05-19
I am trying to determine how big the transfer of a remote call that returns and array of objects is.  Is there any easy way to do this?  
0
Comment
Question by:jjacksn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
Eran_R earned 500 total points
ID: 11872653
If you only need to do this for diagnostic purposes (not every time you are about to make a call, etc),
the answer is simple:

Create an instance of the formatter class used (i.e., if you use soap, create a SoapFormatter object, if you use binary create a BinaryFormatter object).

Then simply call the Serialize() method into a stream and then check the stream length.

Something like:

Object [] array = <...>;
MemoryStream ms = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();

formatter.Serialize(ms, formatter);

Console.WriteLine(ms.Length);


Hope this helps,
Eran
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question