Re: Net Remoting and Performace

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"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>




.



Relevant Pages

  • Re: Compression Algorithm
    ... the copy of the output stream, and observe its length. ... the encoder might have an internal buffer that adds ... to expand the compressed bit string incrementally until the input ... Yes, this is exactly what I want, I need a encoder to compress a bit ...
    (comp.compression)
  • Re: textstreeams of filesystemobjects
    ... for not trying to compress operations into code that's ... That version would check for an actual string to spilt before ... have reached the end of stream previously. ... dim otsln as text stream ...
    (comp.lang.basic.visual.misc)
  • Compress::Zlib unable to inflate
    ... Just trying to understand how the Compress ... calling deflate on an input stream (a string for example) will compress ... inflate on that same stream should restore the original stream. ...
    (comp.lang.perl.modules)
  • Re: Serialization of a complicated class
    ... To serialize to soap you first need to add a reference to the SOAP formatter ... Where st is a stream, and ... > string) of a very complicated object. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to serialize a stream
    ... A memory stream is not a string of bytes. ... string of bytes out of the memory stream and serialize that instead. ...
    (microsoft.public.dotnet.general)