I have been send the packet, In my intranet I can receive the packet correctly,
But in internet I Cannot Receive the Packet,Why ?       Please help me,thank you.

I used ADSL modem  ,My code is here :

int TSendPacket::SendSingalPacket(ip_address DescIp,mac_address DescMac,int 
DescPort,ip_address SourceIp,
                                mac_address SourceMac,int SourcePort,int Protocol, int 
AdaptIndex) ////sendpacket function
{
 pcap_if_t *NetAdapt;
 pcap_t *fp;
 char * err;
 unsigned char packet[46];
 int PacketLen=46;

 NetAdapt=TSendPacket::GetNetAdaptInfo(AdaptIndex) ;
 if (NetAdapt==NULL) return -1;

 if((fp = pcap_open_live(NetAdapt->name, 1000, 1, 1000, err) ) == NULL)
    {
      IsHasBeenSend=false;
      return -1;
    };

 packet[0]=DescMac.byte1;
 packet[1]=DescMac.byte2;
 packet[2]=DescMac.byte3;
 packet[3]=DescMac.byte4;
 packet[4]=DescMac.byte5;
 packet[5]=DescMac.byte6;

 packet[6]=SourceMac.byte1;
 packet[7]=SourceMac.byte2;
 packet[8]=SourceMac.byte3;
 packet[9]=SourceMac.byte4;
 packet[10]=SourceMac.byte5;
 packet[11]=SourceMac.byte6;
 packet[12]= 0x08;
 packet[13]= 0x00;

 packet[14]=0x45;
 packet[15]=0x00;
 packet[16]=0x00;   //
 packet[17]=0x20;   //
 packet[18]=0x00;   //
 packet[19]=0x00;   //

 packet[20]=0x00;   //
 packet[21]=0x00;   //

 packet[22]=0x80;  //
 packet[23]=0x11;  //
 packet[24]=0x00;  //
 packet[25]=0x00;  //

 //Source IP
 packet[26]=SourceIp.byte1;
 packet[27]=SourceIp.byte2;
 packet[28]=SourceIp.byte3;
 packet[29]=SourceIp.byte4;
 //Desc IP

 packet[30]=DescIp.byte1;
 packet[31]=DescIp.byte2;
 packet[32]=DescIp.byte3;
 packet[33]=DescIp.byte4;


  //SourcePort
 //DescPort
 AnsiString SourceP;
 AnsiString DescP;
 SourceP=IntToHex(SourcePort,4);
 DescP=  IntToHex(DescPort,4);

  unsigned char *temp;
  int BufSize=1;
  temp=  new unsigned char(2);

  StrLCopy(temp,SourceP.c_str(),2);
  HexToBin(temp,&(packet[34]),BufSize );
  SourceP.Delete(1,2);
  StrLCopy(temp,SourceP.c_str(),2);
  HexToBin(temp,&(packet[35]),BufSize );

  StrLCopy(temp,DescP.c_str(),2);
  HexToBin(temp,&(packet[36]),BufSize );
  DescP.Delete(1,2);
  StrLCopy(temp,DescP.c_str(),2);
  HexToBin(temp,&(packet[37]),BufSize );
  delete temp;


 packet[38]= 0x00;
 packet[39]= 0x0C;

 packet[40]= 0x12;
 packet[41]= 0x34;

 packet[42]=SourceIp.byte1;
 packet[43]=SourceIp.byte2;
 packet[44]=SourceIp.byte3;
 packet[45]=SourceIp.byte4;

 pcap_sendpacket(fp,packet,PacketLen);

  pcap_freealldevs(NetAdapt);
  IsHasBeenSend=true;
  return 0;
};








����������������������������[EMAIL PROTECTED]
����������������������������������2002-12-12




================================================================= This is the WinPcap 
users list. It is archived at
 http://www.mail-archive.com/[email protected]/

 To unsubscribe use
 mailto: [EMAIL PROTECTED]?body=unsubscribe
=================================================================

Reply via email to