如何判断本地连接是10M,100M,1000M.

xyxfly 2006-07-20 08:04:24
本地连接连上后,会显示速度是10M,100M,或1000M
如何写程序来获得这个速度?

最好不读注册表.

请高手指点,谢谢 :)
...全文
8691 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyxfly 2006-07-26
  • 打赏
  • 举报
回复
算了,结帖,自己再想想
xyxfly 2006-07-25
  • 打赏
  • 举报
回复
自己顶一下, 解决不了的话也这个星期结贴~
Elysium 2006-07-24
  • 打赏
  • 举报
回复
http://www.scriptinganswers.com/Community/DiscussionForums/tabid/154/forumid/6/postid/11985/view/topic/Default.aspx
里面介绍了一个文本文件vbstript采用枚举方式列举了二十来种网卡的属性及配置,基于产品id来判别。
可能windows也是对网卡采用一种id来对应信息的吧,像winxp能自动安装大部分设备驱动应该也是设备厂商向ms提供了一个统一的驱动接口,并取得ms的授权才行,这样ms才能够标示设备的详细信息,相当于ms有一个庞大的产品信息对应表,个人理解,呵呵
xyxfly 2006-07-24
  • 打赏
  • 举报
回复
根据任务栏图标气泡的方法被否决了,各位大哥还有什么高招啊,  WINDOWS是通过什么方法让任务栏的气泡显示100M,10M,还是1000M呢?
Elysium 2006-07-21
  • 打赏
  • 举报
回复
原帖地址:
Determine network connection speed
http://www.ureader.com/message/1371560.aspx
令人沮丧的是最后提到目前好像还没有更好的办法完全确定网速:(
Elysium 2006-07-21
  • 打赏
  • 举报
回复
Determine network connection speed
I'm working on a server application that accepts TCP SOCKET connections
from one or more clients. It needs to recognize when a connection
comes in on a slow link, like dialup or PPP. It then needs to try and
determine the connection speed so it can adjust it data output to the
network.

Any suggestions as to API's and calls to look at for this?

I have tried using GetAdaptersInfo() and with that I can determine that
the Adapter is PPP or SLIP, but so far I can't figure out how to get
from there to the connection speed.

Rod
Date:1 Aug 2005 05:44:02 -0700 Author:


Re: Determine network connection speed

> I'm working on a server application that accepts TCP SOCKET connections
> from one or more clients. It needs to recognize when a connection
> comes in on a slow link, like dialup or PPP. It then needs to try and
> determine the connection speed so it can adjust it data output to the
> network.

Don't do it? ;) All links can be "slow links" if the right things go
wrong so why add complexity to handle a problem that shouldn't exist if
you design the flow control aspect of your protocol correctly in the
first place?

I'd suggest that your server only pushes data to clients when they ask.
So have them send an "OK I'll have some more please" message back to the
server. You can make it as complex as you like, allow for as much data
to be 'on the wire' as you want but at some point the server should stop
sending until the client says OK. Once this works you can track the
average speed that the client wants to receive data at, if that makes it
easier for whatever is producing the data to do so at the right
speed/density.

If you cant change the protocol then you can try and drive the server's
transmission off of the previous send completing, but that's not quite
so straight forward.

--
Len Holgate - http://www.lenholgate.com
JetByte Limited - http://www.jetbyte.com
The right code, right now.
Contract Programming and Consulting Services.
Date:Mon, 01 Aug 2005 14:19:04 +0100 Author:


Re: Determine network connection speed
Our problem seems to occur at the Windows networking level. We've done
the things you suggest about controlling the transmission of the data.
What happens is that something in the networking layers is buffering
data on us and we have been unable to stop that. We've tried all the
obvious things like Nagle but somewhere down there it is buffering just
enough to cause us problems. We have found that if we limit our output
data rate we can get the results we need. All we are trying for now is
to set the output rate dynamically by detecting that the client is
connecting over PPP and the rate that the link is set to.
Date:1 Aug 2005 07:09:22 -0700 Author:


Re: Determine network connection speed
If you interested in value of connection speed ( default ) for adapter (
NIC )
you can or use WMI ( googlize "MSNdis_LinkSpeed" ) or use OID ( which
internally used by WMI ) :
OID_GEN_LINK_SPEED for interested adapter

Arkady

wrote in message
news:1122900242.010548.256100@g49g2000cwa.googlegroups.com...
> I'm working on a server application that accepts TCP SOCKET connections
> from one or more clients. It needs to recognize when a connection
> comes in on a slow link, like dialup or PPP. It then needs to try and
> determine the connection speed so it can adjust it data output to the
> network.
>
> Any suggestions as to API's and calls to look at for this?
>
> I have tried using GetAdaptersInfo() and with that I can determine that
> the Adapter is PPP or SLIP, but so far I can't figure out how to get
> from there to the connection speed.
>
> Rod
>

Date:Mon, 1 Aug 2005 17:44:08 +0200 Author:


Re: Determine network connection speed
Forgot to mention additional variant :
dwSpeed member of MIB_IFROW from GetIfEntry()
Arkady

"Arkady Frenkel" wrote in message
news:ulyYtdqlFHA.2484@TK2MSFTNGP15.phx.gbl...
> If you interested in value of connection speed ( default ) for adapter (
> NIC )
> you can or use WMI ( googlize "MSNdis_LinkSpeed" ) or use OID ( which
> internally used by WMI ) :
> OID_GEN_LINK_SPEED for interested adapter
>
> Arkady
>
> wrote in message
> news:1122900242.010548.256100@g49g2000cwa.googlegroups.com...
>> I'm working on a server application that accepts TCP SOCKET connections
>> from one or more clients. It needs to recognize when a connection
>> comes in on a slow link, like dialup or PPP. It then needs to try and
>> determine the connection speed so it can adjust it data output to the
>> network.
>>
>> Any suggestions as to API's and calls to look at for this?
>>
>> I have tried using GetAdaptersInfo() and with that I can determine that
>> the Adapter is PPP or SLIP, but so far I can't figure out how to get
>> from there to the connection speed.
>>
>> Rod
>>
>
>

Date:Mon, 1 Aug 2005 18:15:05 +0200 Author:


Re: Determine network connection speed
Perhaps the socket send buffer? That's 8K by default.
However, keep in mind the network itself buffers data
as well - in all routers along the way.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

wrote in message
news:1122905362.329009.175550@g49g2000cwa.googlegroups.com...
> Our problem seems to occur at the Windows networking level. We've done
> the things you suggest about controlling the transmission of the data.
> What happens is that something in the networking layers is buffering
> data on us and we have been unable to stop that. We've tried all the
> obvious things like Nagle but somewhere down there it is buffering just
> enough to cause us problems. We have found that if we limit our output
> data rate we can get the results we need. All we are trying for now is
> to set the output rate dynamically by detecting that the client is
> connecting over PPP and the rate that the link is set to.
>

Date:Mon, 1 Aug 2005 11:25:38 -0700 Author:


Re: Determine network connection speed
I tried using WMI to get the MSNdis_LinkSpeed but for some reason it
reports 28.8 for the connection even though I have the connection
running at 115.2. When I right click on the connection in the system
try it reports that it is 115.2. Is there a WMI call to get that info?
Date:4 Aug 2005 07:51:02 -0700 Author:


Re: Determine network connection speed
Oh, and if anyone is interested in a great tool for checking out WMI
stuff the Scriptomatic 2.0 tool from Microsoft is it.
Date:4 Aug 2005 07:53:11 -0700 Author:


Re: Determine network connection speed
"rkrato@gmail.com" wrote:
> I tried using WMI to get the MSNdis_LinkSpeed but for some reason it
> reports 28.8 for the connection even though I have the connection
> running at 115.2. When I right click on the connection in the system
> try it reports that it is 115.2. Is there a WMI call to get that info?

115.2 is your COM port speed - which is completely unrelated to the
link speed of the modem (or whatever you have).
Same with LAN connections: even if the netcard works at 100 mbps,
the actual cable/DSL modem behind it is much slower.
There is almost no way to determine connection speed, besides
of metering your actual connection
Longhorn will have a new technology called qWave to help apps in this task

--PA

husheng34 2006-07-21
  • 打赏
  • 举报
回复
wmic 编程不知行不行
xyxfly 2006-07-21
  • 打赏
  • 举报
回复
自己再顶下
xyxfly 2006-07-21
  • 打赏
  • 举报
回复
xiexie ,我先看看
xyxfly 2006-07-20
  • 打赏
  • 举报
回复
怎么这么冷清啊? :(
xyxfly 2006-07-20
  • 打赏
  • 举报
回复
而且上面说的方法写出来的程序通用性不好吧, 任务栏的结构跟操作系统有关,那在XP下可以,在VISTA下就不行了, 有没有好的解决办法,期待...
xyxfly 2006-07-20
  • 打赏
  • 举报
回复
上面两位大哥说的不失为一种方法, 另外两个关于这个问题的帖子已经结贴,这个贴子我想先再放2天,看看还有没有其他好的办法。

读注册表好像是不行的,我搜索了半天只在注册表中找到一个健值。而且感觉没什么用 :(
xx_jj 2006-07-20
  • 打赏
  • 举报
回复
试图通过任务栏图标的气泡得到
折腾_苏州 2006-07-20
  • 打赏
  • 举报
回复
去看看我的BLOG:
http://blog.csdn.net/seu07201213/archive/2006/07/07/891274.aspx

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧