Solved

Getting the LAN Connection Speed 10 mbits  100 mbits, Half Duplex / Full duplex

Posted on 2004-10-19
4
1,172 Views
Last Modified: 2010-05-18
Does any one know how to get the Local area network connection speed?

I need to know if it is 10, 100 or 1000
and if it is Half duplex or Full duplex

Using Delphi 7, Windows 2000 pro

Cheers Darren
0
Comment
Question by:dhnkley
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12355969
Interesting... I expected this information to be available through WMI but it isn't. Besides, you might be in trouble since there are some different network speeds available too. I once had an USB connection between two PC's and this was listed as only 5 mbit. My wireless network card claims it's 45 mbit most of the time. Still, I think you can get the performance data through WMI which should give you the bandwidth value and lots of other information.
0
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 500 total points
ID: 12368063
I've done some search in WMI. You could use a 'select CurrentBandwidth, Name from Win32_PerfRawData_Tcpip_NetworkInterface' query in WMI to get the bandwidth per network controller. However, determining duplex mode is something I haven't found within WMI.

This code gets the bandwidth for all network cards:

uses
  Windows, SysUtils, Classes, ActiveX, ComObj, WbemScripting_TLB;

const
  sQuery = 'select CurrentBandwidth, Name from Win32_PerfRawData_Tcpip_NetworkInterface';
var
  Enum: IEnumVariant;
  Item: SWbemObject;
begin
  Enum := CoSWbemLocator.Create.ConnectServer( '', 'root\cimv2', '', '', '', '', 0, nil ).ExecQuery( sQuery, 'WQL', wbemFlagBidirectional, nil )._NewEnum as IEnumVariant;
  while NextItem( Enum, SWBemObject, Item ) do begin
    WriteLn( 'Network ', VarToStr( Item.Properties_.Item( 'Name', 0 ) ), ', bandwidth ', VarToStr( Item.Properties_.Item( 'CurrentBandwidth', 0 ) ) );
  end;
end;

WbemScripting_TLB is created by converting the C:\WINNT\system32\wbem\wbemdisp.tlb type library to Delphi. But for Delphi 7 I've already created a version at http://www.workshop-alex.org/Sources/WbemScripting_TLB.pas that can be used.
Now, all you need is the Duplex info. :-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now