怎么通过socket来send unsigned char类型的数据
如何通过socket来send unsigned char类型的数据
SOCKET传递数据中
由于发送数据中一位通过其ASSCII码表示长度,可能会有ACSII码超过127的内容,所以我用了unsigned char类型的数据
unsigned char buf_send[2048+1];
memset( buf_send , 0 , 2048+1);
...
send(sock,
buf_send,
n,
0
);
直接调用send会报错
'send ' : cannot convert parameter 2 from 'unsigned char [2049] ' to 'const char * '
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
请问该怎么做,能发送unsigned char类型的数据吗
------解决方案--------------------
send(sock,
(char *)buf_send,
n,
0
);
SOCKET传递数据中
由于发送数据中一位通过其ASSCII码表示长度,可能会有ACSII码超过127的内容,所以我用了unsigned char类型的数据
unsigned char buf_send[2048+1];
memset( buf_send , 0 , 2048+1);
...
send(sock,
buf_send,
n,
0
);
直接调用send会报错
'send ' : cannot convert parameter 2 from 'unsigned char [2049] ' to 'const char * '
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
请问该怎么做,能发送unsigned char类型的数据吗
------解决方案--------------------
send(sock,
(char *)buf_send,
n,
0
);