C# 编程中 socket接收的数据包问题 急,求大神
byte[] bytesReceived = new Byte[1024];
s.Send(bytesSent, bytesSent.Length, 0);
bytes = s.Receive(bytesReceived, bytesReceived.Length, 0);
大体如这个,bytes中包含有一段头文件 以及一个图片的二进制数据
如何分开来呢?或者怎么屏蔽头文件的接收呀
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 15 Oct 2012 04:13:05 GMT
Content-Type: image/JPEG
Transfer-Encoding: chunked
X-Powered-By: PHP/5.3.5
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
1098
?PNG
如上,转成字符串后是这样的,直接转图片很定要不行了,求解呀 坐等
------解决方案--------------------
既然Content-Type: image/JPEG,那直接构建Image,Image.FromStream()就可以啊。
------解决方案--------------------
提问很不清楚.
XML code
byte[] bytesReceived = new Byte[1024];
s.Send(bytesSent, bytesSent.Length, 0);
bytes = s.Receive(bytesReceived, bytesReceived.Length, 0);
大体如这个,bytes中包含有一段头文件 以及一个图片的二进制数据
------解决方案--------------------
头信息中必须有图像数据从哪里开始,多长等信息,你根据这些信息去读取