Happy Shrimp
http://blog.csdn.net/lights_joy/
Welcome reprint, but please keep the author information
In the previous section, we used fdnetdevice for real-time simulations, using NS3 to send pings to an actual machine package, but the results are obviously a bit off our expected result, because Ping The response time of the package is significantly longer than the response time under normal circumstances.
this is for NS3 Send Ping The result of the package:
Use WireShark in the NS3 using the adapter on the clutch, this is the packet caught on the physical NIC:
obviously the response to the end is no problem, the problem arises in WinPcap on the Send? Just learn ICMPv4 also encountered this problem, together solve it. A search on the internet seems to be the problem occurs when you open a winpcap device with the specified parameters:
if (Adhandle = Pcap_open_live (M_devicename.c_str (),//name of the device65536,//portion of the packet to capture.//655 Grants that the whole packet would be captured on all the macs.1,//promiscuous mode (nonzero means promiscuous) 1000,// Read timeouterrbuf//error buffer) = = NULL) {fprintf (stderr, "\nunable to open the adapter. %s is not supported by Winpcap\n ", M_devicename.c_str ()); return-1;}
Here's Read Timeout values come directly from WinPcap Sample code, check the meaning of this parameter:
Read_timeout,: read timeoutin milliseconds. The read timeout is used to arrange that the read notnecessarily return immediately when a packet was seen, but that it Wai TS Forsome amount of time to allow more packets to arrive and to read multiplepackets from the OS kernel in one operation. Not all platforms support a readtimeout; On platforms that's Don ' t, the read timeout is ignored.
change this value to 1 . Perform the simulation again
This is a better result. ~~~ , and then change to -1 Try :
better results, just at the moment CPU Higher usage rates.
??
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
NS3 network emulation: Fdnetdevice issues