Re: Net Remoting and Performace
- From: "Mr. Arnold" <MR. Arnold@xxxxxxxxxx>
- Date: Mon, 7 Jan 2008 19:44:45 -0500
"How to get a common name(CN) of SSL" <HowtogetacommonnameCNofSSL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:6D585E7B-264A-46CF-B32F-623C7AF3F68D@xxxxxxxxxxxxxxxx
"Mr. Arnold" wrote:
"How to get a common name(CN) of SSL"
<HowtogetacommonnameCNofSSL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7374FE94-9332-4C6C-904A-C36B1E377E91@xxxxxxxxxxxxxxxx
> How can i solve this kind of problem, because i want to send a lot of > data
> and as soon as faster from Client To Server.
>
>
> anyone help me how to solve this kind of problem.
You use the Binary Formatters, serialize the data, and compress the data.
You deserialize and uncompress the data on the other side.
Thank you for your reply,
Could you show me a sample program about binary formatter, Serialize and
Compress the data.
because i don't know how to do that very well.
There is a project for Contacts on how to use a Binary Formatter.
http://docs.msdnaa.net/ark_new3.0/cd3/content/Tech_Visual%20CSharp.htm
What you'll want to do is have a Class/object on the client side and server the same object that represents the data. You're going to populate the object with your data with object accessor properties that represent your data int, string, double, etc. You'll use the [Serializable] attribute at the top of the class. You'll serialize the object to XML using a Memory Stream. You send the data to the server, and you'll deserialize it back into the object. Again, the class must be on the client and server sides.
Here is some code for compressing data. You'll notice that it's doing it with a Memory Stream, using sharpziplib.
http://www.google.com/search?hl=en&q=sharpziplib&btnG=Google+Search
As for the .Net Remoting and Binary Formatter on the TCP, you can use Google and look it up.
HTH
public static string GetFileData( string filename, SAISDataFormat format )
{
//Make sure the file exists
if(!File.Exists(filename))
throw new Exception("FILE DOES NOT EXIST!");
//Get the file data
StreamReader reader = new StreamReader( filename );
string data = reader.ReadToEnd();
reader.Close();
//Check if we should compress the data
MemoryStream ms = null;
Stream output = null;
switch(format)
{
case SAISDataFormat.XML:
return data;
case SAISDataFormat.XML_BZ:
ms = new MemoryStream();
output = new BZip2OutputStream( ms );
break;
case SAISDataFormat.XML_GZ:
ms = new MemoryStream();
output = new GZipOutputStream( ms );
break;
}
//Compress the data by writing it to the output stream
byte[] buffer = System.Text.Encoding.Unicode.GetBytes ( data );
output.Write( buffer, 0, buffer.Length );
output.Close();
//Read out the compressed data and base64 encode it
buffer = ms.GetBuffer();
ms.Close();
string outputBase64 = Convert.ToBase64String( buffer );
//Return the Base64 encoding file data
return outputBase64;
}
/// <summary>
.
- References:
- Net Remoting and Performace
- From: How to get a common name(CN) of SSL
- Re: Net Remoting and Performace
- From: Mr. Arnold
- Re: Net Remoting and Performace
- From: How to get a common name(CN) of SSL
- Net Remoting and Performace
- Prev by Date: Re: Error running app but not while debugging!
- Next by Date: Re: Problem with BackLog (TCP Queue)..
- Previous by thread: Re: Net Remoting and Performace
- Next by thread: Re: Net Remoting and Performace
- Index(es):
Relevant Pages
|