communication message in component protocol

Hi everyone,

I meet a problem. I code 2 project to try communication between two program. My programs are modified from sample statusviewer. I use my MessageId “MessageRequest”. Everything is ok. I try changing namespace of the one program. the default value is “StatusViewer”. if I change to “StatusViewer1”, two program can’t communicate. I debug, I find out message.Data == null. if I change namespace to “StatusViewer”, everything is Ok. I don’t know why?

Can anyone help me?

Thank in advance.

What happen is that the classes are serialized and deserialized, so they must be same in both ends and in the same dll.

An alternative is to use strings, which you yourself can decide the contents of, even by you own serialize and deserialize routines.

Hi Bo,

Can you instruct more detail for me? I don’t understand the way use string, which you recommend?

I want to send and receive data class:

RequesData {

String time;

byte[] arrayData;

}

Thank you so much

What I meant was to manually serialize and deserialize your class into a string, which is then passed over the wire in the Data parameter. This could e.g. be done by concatenating your time string with a base64-encoded string version of your byte array and with some separator in between that will make it easy to separate the two again on the receiving end.

Alternatively, the more ‘correct’ way would be to move your RequestData class into a separate assembly, which is then shared by the sender and the receiver, but that would of course require it to be distributed along with these.

Hi Bo,

I tried all two method. they both are Ok.

Thank you so much.