Solved

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

Posted on 2004-10-19
4
1,191 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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