开发者

Sending an image data over a socket, but it receives of some different format when it reaches server

开发者 https://www.devze.com 2023-03-09 21:27 出处:网络
I am cre开发者_如何学运维ate a NSData file from the image and sending over server using socket.

I am cre开发者_如何学运维ate a NSData file from the image and sending over server using socket.

CFWriteStreamWrite(myWriteStream, (const UInt8 *)data, [data length]);

But the server receives it in different format. and unable to open file.


What's the type of 'data' in your code snippet?

If it was a (NSData *) object, you should write like:

CFWriteStreamWrite(myWriteStream, (const UInt8 *)[data bytes], [data length]);
0

精彩评论

暂无评论...
验证码 换一张
取 消