Solved

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

Posted on 2004-10-19
4
1,196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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