流媒体网欢迎您!
全世界的网络联合起来,流媒体世界一定能实现!
 
   
IPTV | P2P流媒体 | 移动流媒体 | 数字家庭 | 流媒体宽频 | 网络流媒体 | 安防监控 | 视频会议 | VIP会员 | 行业专题 | 业内专访
 
 
 
您现在的位置: 流媒体网 >> P2P >> 程序源码 >> P2P正文
 
P2P之UDP穿透NAT的原理与实现(附源代码)
作者:shooting…  来源:p2pcn  发布时间:2006-4-25 11:11:00

erName);
      stUserListNode *currentuser = new stUserListNode();
      strcpy(currentuser->userName, recvbuf.message.loginmember.userName);
      currentuser->ip = ntohl(sender.sin_addr.S_un.S_addr);
      currentuser->port = ntohs(sender.sin_port);
     
      ClientList.push_back(currentuser);

      // 发送已经登陆的客户信息
      int nodecount = (int)ClientList.size();
      sendto(PrimaryUDP, (const char*)&nodecount, sizeof(int), 0, (const sockaddr*)&sender, sizeof(sender));
      for(UserList::iterator UserIterator=ClientList.begin();
        UserIterator!=ClientList.end();
        ++UserIterator)
      {
       sendto(PrimaryUDP, (const char*)(*UserIterator), sizeof(stUserListNode), 0, (const sockaddr*)&sender, sizeof(sender));
      }

      break;
     }
    case LOGOUT:
     {
      // 将此客户信息删除
      printf("has a user logout : %s\n", recvbuf.message.logoutmember.userName);
      UserList::iterator removeiterator = NULL;
      for(UserList::iterator UserIterator=ClientList.begin();
       UserIterator!=ClientList.end();
       ++UserIterator)
      {
       if( strcmp( ((*UserIterator)->userName), recvbuf.message.logoutmember.userName) == 0 )
    &

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

    
责任编辑:playcat911

发表评论】【告诉好友】【打印此文】【关闭窗口收藏此页到365Key   

  • 上一篇P2P:
  • 下一篇P2P: 没有了
  •  
    相关新闻
    试论当前P2P发展现状与运营方案
    P4P异军突起,P2P即将过时?
    网络电视正在改变中外互联网格局
    P2P应用调查:Gnutella用户最多 BT其次
    LimeWire仍为最流行P2P软件  µTorrent紧追