直接发送和接收结构体,例如:struct A {...};struct A objectA;发送的时候: tcpSocket->write((char *)&objectA, sizeof(objectA)); 接收的时候:struct A objectB;tcpSocket->read((char *)&objectA, sizeof(objectA));
http://blog.csdn.net/emdfans/article/details/23869325