I receive function code:
_client=new TcpClient (ipadd, port);
Ns=_client. GetStream ();
Private void recvdata ()//receiving data
{
While (true)
{
int len=0;
Byte [] bitLen=new byte [8].
Len=ns. Read (bitLen, 0, bitLen. Length);
Long contentLen=BitConverter. ToInt64 (bitLen, 0).
Int size=0;
MemoryStream ms=new MemoryStream ();
While (size & lt; ContentLen)
{
//points to receive many times, each receiving 256 bytes,
Byte [] bits=new byte [256].
Int r=Ms. Read (bits, 0, bits. Length);
If (r & lt;=0) break;
Ms. Write (bits, 0, r);
The size +=r;
}
Image img=Image. FromStream (ms). is an error in this sentence, prompt parameter error
PictureBox1. Image=img;
For the Enabled=true;
Button2. Enabled=false;
Send. Enabled=false;
}
}
CodePudding user response:
Parameter error, suggest you don't check the parameters of the type and numberCodePudding user response:
There is a problem how do I know can't sending data into images.CodePudding user response: