Solved

Determining the size of transfer of a remote object

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Loop not working 29 47
How to write a select year(max(datefield) in EntitySQL in  c# entity framework 12 27
how to read json value 2 27
ASP.NET 5 Templates 2 65
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now