I am currently trying to send a serialized object over a TCP connection as follows –
BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(clientStream, (Object)Assembly.LoadFrom('test.dll'));
where clientStream is
TcpClient tcpClient = (TcpClient)client; NetworkStream clientStream = tcpClient.GetStream();
This is the sending part. But can anyone tell me how do I receive this on the client side (i.e. deserialize it on the other end)?
Don’t serialize the assembly. Send the assembly itself just by loading it as a file and sending those bytes to the other side.
Then, when both sides have the same code, send the object via serialization. I believe the AppDomain which deserializes the object will have to have the relevant assembly loaded (or at least available to be loaded).