socket 传结构体问题
struct test{
int x;
char y;
};
struct test t;
t.x = 44;
t.y = 'a';
int sl =send(client,(const char *)&t,sizeof(t),0);
socket 发送 后 在SERVER 端 接收到" ,a" 这样的数据 像这种里面有不同类型数据的结构体做SOCKET 数据源 如何才能让它在服务器端也能正确显示啊?
我要是转换成 字符型的就会" ,a"要转换成整型的就是 4497 这样很郁闷呐。。。