[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Markus Minichmayr

9/30/2004 9:04:00 PM

Hello!

I have a client/server app., that communicates via .NET remoting and I need
to transport large binary objects, encapsulated in a special class. The
clients sumtimes run on the same machine as the server and sometimes on
others.

My Problem:
For performance reasons I need to change the serialization algorithm,
dependent on the remoting target. I.e.: I want to compress the data if the
client and the server run on different machines, and I want to deliver the
data uncompressed, if they run on the same machine.

I wrote a customized Serialization routine, examining the void
GetObjectData(SerializationInfo info, StreamingContext context)
context.State parameter, doing compression if the
StreamingContextStates.CrossMachine flag is set. Unforunately the
StreamingContext.State is always set to StreamingContextStates.Other if
serialization is performed by the remoting framework. My code looks similar
to the following:

public void GetObjectData(SerializationInfo info, StreamingContext context)

{

StreamingContextStates state = context.State;

bool isCrossMachine = (state & StreamingContextStates.CrossMachine) ==
StreamingContextStates.CrossMachine;

if (isCrossMachine)

{

.... serialize with compression

}

else

{

.... serialize without compression

}

}



Can anybody give me a hint, how to solve the problem? Thanx in advance.

-Markus