client代码
map<string,string> myMap;
myMap.insert(pair<string,string>("abc","abc"));
send(sClient,(char *)&myMap,sizeof(myMap),0);
server代码
char *buff = (char *)malloc(126);
memset(buff,0,126);
int retVal = recv(s,buff,126,0);
if(retVal == SOCKET_ERROR || retVal == 0)
{
showMsg("recv() failed or client exit!");
break;
}
map<string,string> *mm = (map<string,string> *)buff;
转成mm后,里面的东西就变成?号了...