我正在通过UDP 套接字发送序列化的大图像对象。当我在内存流中写入所有接收到的字节并传递内存流对象进行反序列化时,它会引发异常No assembly ID for object type 'ImagePacket'。
接收端代码:
ImageStream = new MemoryStream();
while (AccumulatingBytes <= TotalSizeOfComplexObject)
{
byte[] Recievedbytes = UdpListener.Receive(ref RemoteEndPoint);
ImageStream.Write(Recievedbytes, 0, Recievedbytes.Length);
AccumulatingBytes += Recievedbytes.Length;
}
ImageStream.Position = 0;
imagecontainer = (ImageContainer)bformater.Deserialize(ImageStream);//Here the Code Segment Breaks and Exception thrown