SOCKET用的是哪一個IP

/*(--找出SOCKET用的是哪一個IP(專門針對一個網卡上配置了多個ip的情況)--)*/
void getMacIpNetmask(char *resultbuf,char *aa,char *bb)
{
 char macbuf[30]="";
 char temp1[100]="";
 char temp2[100]="";
 getMatchValue(macbuf,aa,"mac");
 while(strstr(aa,"ip")!=NULL)
 {
  aa=strstr(aa,"ip");
  getMatchValue(temp1,aa,"ip");
  if(strcmp(temp1,bb)==0)
  {
   getMatchValue(temp2,aa,"netmask");

   strcat(resultbuf,"mac=");
   strcat(resultbuf,macbuf);
   strcat(resultbuf,",");
   strcat(resultbuf,"ip=");
   strcat(resultbuf,temp1);
   strcat(resultbuf,",");
   strcat(resultbuf,"netmask=");
   strcat(resultbuf,temp2);
   break;
  }
  aa=strstr(aa,"netmask");
  memset(temp1,0,100);
  memset(temp2,0,100);
   
 }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章