[Winpcap-users] about the sending packets rate...
yulou liu
lyulou at gmail.com
Wed Apr 28 09:47:13 PDT 2010
hi
I have been working on a project in which PC send/receive ethernet
frame to/from a FPGA board.
The connection via a 1 Gb switcher.
In order to test the limitation of the switcher, I send a big file
(about 2.6GB) from PC TO PC via the switcher by an application like
IM. The rate is about 30 MB/s.
I programmed a software based on winpcap, but the rate of sending
seems not so fast as what it is supposed to be. The rate is about
4MB/S.
In order to figure out the bottleneck, I made a simplest program
which only sends Ethernet frame in loop. Each frame 's size is
about 1460 bytes. And I captured the frame by Wireshark. I noticed
that the period time between each frames is about 0.0002
seconds. According to that , I can calculate the rate like : 1460
bytes/ 0.0002= 6.9 MB/S. And I runed the program on PCs with 100M
Ethernet cards and on 1G Ethernet cards. There is no difference no
matter that the netcard is 100M or 1G.
The question is how could I improve Is there any parameters that I
need to configure to improve the period time between the frames so
that I can increase the rate of sending Ethernet frame ?
void CWndDown::OnBtnTst()
{
// TODO: Add your control notification handler code here
//
int iAmount= sizeof (FrameHead ) + sizeof(FrameHead2 )+1440*sizeof
(char);//length of the frame
unsigned char *pData2=new unsigned char [iAmount ];//
FrameHead * pfHead=(FrameHead *)pData2; //
FrameHead2 * pfHead2=(FrameHead2 *)( pData2+sizeof (FrameHead ));//
unsigned char *pData=(unsigned char *)( pData2+sizeof (FrameHead ) +
sizeof(FrameHead2 ));//
CString tmp; //
unsigned char pp[6];//
unsigned long i;
//get the destination'S MAC
for(i=0;i<6;i++)
{
tmp.Format("0x%c%c",m_MacAddrSel.macAddrFpgaA.GetAt(i*3),
m_MacAddrSel.macAddrFpgaA.GetAt(i*3+1));
pp[i]=_tcstoul(tmp,0,16);
}
pfHead->DesAddr.addr0=pp[0];
pfHead->DesAddr.addr1=pp[1];
pfHead->DesAddr.addr2=pp[2];
pfHead->DesAddr.addr3=pp[3];
pfHead->DesAddr.addr4=pp[4];
pfHead->DesAddr.addr5=pp[5];
//get the SOURCE'S MAC
for(i=0;i<6;i++)
{
tmp.Format("0x%c%c",m_MacAddrSel.macAddrPc.GetAt(i*3),
m_MacAddrSel.macAddrPc.GetAt(i*3+1));
pp[i]=_tcstoul(tmp,0,16);//
}
pfHead->SrcAddr.addr0=pp[0];
pfHead->SrcAddr.addr1=pp[1];
pfHead->SrcAddr.addr2=pp[2];
pfHead->SrcAddr.addr3=pp[3];
pfHead->SrcAddr.addr4=pp[4];
pfHead->SrcAddr.addr5=pp[5];
pfHead->FrmLgth=htons(0x002e);//
pfHead->FrmTyp=htons(FRAME_DATA);
pfHead2->len= 1;
memset(pData, 0x55, 1440);
pfHead2->seq=htonl(i);
int iLoopTime=1;
while(iLoopTime)
{
/* SEND PACKETS */
if (pcap_sendpacket(m_gadhandle,pData2, iAmount ) != 0)
{
MessageBox("\nError sending the packet: \n","提示",MB_OK|
MB_ICONINFORMATION);
}
}
delete []pData2;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20100429/a3199be5/attachment.htm
More information about the Winpcap-users
mailing list