I too have had some problems getting the NIC recognised in the simulator. (VS2008, XP)
It worked the first time.. but after that nothing, not even an answer to a ping.
To get it back I did the following:
Closed the simulator -> deleted the NIC.ini file -> restarted the simulator -> reselected the interface from the menu:
Hay presto : it worked again.
So, I investigated what happens in the handler for dropdown NIC selector .v. what happens during the application startup..
This is what happens when the drop down is selected.. - in SetNIC(..)
case IDOK:
if (iNewSelection != iactive) {
if (iUserNIC < 0) {
iactive = iNewSelection;
fnWinPcapClose(); // close present adapter
fnWinPcapSelectLAN(iNewSelection);
fnWinPcapOpenAdapter();
}
iUserNIC = iNewSelection;
}
This is what happens during the application startup.. - in WndProc(..)
case WM_CREATE:
#ifdef ETH_INTERFACE // {10}
iUserNIC = fnGetUserNIC();
fnWinPcapSelectLAN(iUserNIC); // select the NIC according to the user setting
#endif
__
I noticed when the application is started up, the NIC was selected, but not started up. I added the following lines, and fixed the compile errors and hey presto.. it worked. Green lights flashing again!
case WM_CREATE:
#ifdef ETH_INTERFACE // {10}
iUserNIC = fnGetUserNIC();fnWinPcapSelectLAN(iUserNIC); // select the NIC according to the user setting
fnWinPcapOpenAdapter();
fnWinPcapStartLink(ghWnd);
#endif
I have a number of possible interfaces to select, so it could be getting confused.
Also, I ended up changing the code that checks the selection had changed, this gave more reliable 'switching' between different interfaces while running. The condition: "if (iUserNIC < 0)" was never satisfied, and hence, never changed the interface.
case IDOK:
if (iNewSelection != iactive) {
if (iNewSelection >= 0) {
fnWinPcapClose(); // close present adapter
fnWinPcapSelectLAN(iNewSelection);
fnWinPcapOpenAdapter();
}
iactive = iNewSelection;
iUserNIC = iNewSelection;
}
This caused the NIC to startup reliably in the sim, and change following a reselection in the drop down.
Not saying I fixed it, its just what got me working.
I'm hoping I have not introduced a new bug in the process!!
These problems could be linked to having a long list of interfaces in the drop down list. In my case 4. I have to select the third of 4.
Post here if this helps..
Jon.
EDIT:
The application sometimes crashes on startup, and the green LEDs dont work too well.. but it is responding ok.
I think there is a threading issue with PCap and the Windows application.
A better solution anybody?