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