[Winpcap-users] pcap_sendpacket - different results on 3.1 and 4.0

Gianluca Varenni gianluca.varenni at cacetech.com
Sun Oct 25 22:56:09 PDT 2009


----- Original Message ----- 
From: "Helmut Vaupotitsch" <helmut.vaupotitsch at gmx.net>
To: <winpcap-users at winpcap.org>
Sent: Sunday, October 25, 2009 12:46 AM
Subject: [Winpcap-users] pcap_sendpacket - different results on 3.1 and 4.0


> Hi,
>
> My application uses the result of pcap_sendpacket() for a mechanism to
> detect if a network cable is connected to the bound adapter. The result
> is different if no cable is connected and a different driver is used:
>
> LibraryVersion: WinPcap version 3.1 (packet.dll version 3, 1, 0, 27),
> based on libpcap version 0.9[.x].
> Result is < 0 if no cable is connected
> FLibraryVersion: WinPcap version 4.0.2 (packet.dll version 4.0.0.1040),
> based on libpcap version 0.9.5'
> Result is always 0
>
> Question: What´s the reason for this behaviour, does the newer driver
> use a transmitt queue internally? i read also

The transmission code has been heavily rewritten over the years, so it's 
possible that this behavior changed (not on purpose, though). Please 
consider that the behavior of pcap_sendpacket() when the network cable is 
disconnected (in case of ethernet. In case of wireless, it would be a bit 
different) has never been documented, so I wouldn't rely on it.

Does WinPcap 4.1.1 show the same behavior? I can definitely have a look into 
that if 4.1.1 still shows this behavior.

> http://winpcap.cs.pu.edu.tw/pipermail/winpcap-users/2008-September/002775.html
>
> Question: how can i detect undoubtable if the bound adapter is currently
> physically connected(Link is active)?
> i could use GetIfTable from IPHLPAPI.DLL and look at the "Operational
> Status", but IMHO this wastes a lot of time.

Why does it waste time?

> Can i use a OID PacketRequest for this purpose?
>

You can (at least in the case of ethernet), OID_GEN_MEDIA_CONNECT_STATUS. 
Please remember that the Packet API is deprecated and subject to change 
without any notice.

Have a nice day
GV

> Using WinXP SP2 / Delphi
>
> Thanks in advance
> Helmut
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
> 



More information about the Winpcap-users mailing list