socket收发出现乱码的问题,麻烦大家看看
 这个程序主要是实现通过两台机子聊天的功能 
 接收程序: 
 void   *process_r(void*   a) 
 { 
                         assert(NULL   !=   a); 
                         MSG   msg; 
                         int   sockfd   =   static_cast <multi_data   *> (a)-> fd; 
                         for(;;) 
                         { 
 A:                                          if(recv(sockfd,&msg.length,sizeof(msg.length),0)   ==   -1) 
                                                 { 
                                                                         perror( "recv "); 
                                                                         return(NULL); 
                                                 } 
                                                 if(0   ==   msg.length) 
                                                 { 
                                                                         goto   A; 
                                                 } 
                                                 pthread_testcancel();//设置线程安全取消点 
                                                 msg.data   =   new   char[ntohl(msg.length)]; 
                                                 if(recv(sockfd,const_cast <char*> (msg.data),sizeof(*msg.data)*ntohl(msg.length),0)   ==   -1) 
                                                 { 
                                                                         perror( "recv "); 
                                                                         return(NULL); 
                                                 } 
                                                 string   words_recv(msg.data); 
                                                 if(!words_recv.empty()) 
                                                 { 
 //    &