关于序列化对象的问题 过程中代码运行到一半就没有往下运行了
public void listrnerserver(){
Byte[] Gbuff = new Byte[1024];
ctrl m = new ctrl();
MemoryStream mstream = new MemoryStream();
mstream.Position = 0;
while (true)
{
int i = nstream.Read(Gbuff, 0, Gbuff.Length);
if (i==0)
{
break;
}
else
{
MessageBox.Show("成功获取到数据");
mstream.Write(Gbuff, 0, i);
//这个地方开始就没有继续往下运行了
}
}
mstream.Flush();
mstream.Position = 0;
BinaryFormatter bformatter = new BinaryFormatter();
if (mstream.Capacity > 0)
{
m = (ctrl)bformatter.Deserialize(mstream);
}
else
{
MessageBox.Show("接收的数据为空");
}
MessageBox.Show(m.m_ctrl.ToString());
}