Solved

Determining the size of transfer of a remote object

Posted on 2004-08-21
3
193 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

751 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