Detecting Modem Connections

Started by
6 comments, last by Sneftel 18 years, 8 months ago
How can I detect if a user is connected to the net on a modem? I don't want to check transfer speed, as that can be misleading if they are using up their bandwidth with something else. Can I enumerate things in WinSock or somewhere else? I know WinSock has EnumProtocols (and WSAEnumProtocols), but those don't seem to tell me the physical means that it's connecting, just the protocol.
Advertisement
You can use RasEnumConnections to see if there are any active RAS connections. What are you trying to do this for?
Autoselection of the connection, I don't want to rely on the user selecting their connection, and I don't want to test the current download speed. Ultimately, I want to take action depending on the connection, automatically using the smaller data for modem users, but still accessing larger data for users with a faster connection.
Probably a bad idea... this wouldn't allow you to cope with congested connections. Testing the download speed would be much more effective.
But that won't produce acurate results all the time, will it? If I try to download a file in my app to test the speed, but the user is downloading something else and taking up all the bandwidth, then my download rate that I detect will be considerably off. The speed also depends on where I am downloading a file from, so if I'm downloading from a slow server, or the server just happens to be lagging, then my program might detect the connection as a modem speed, when it's really a lan or cable modem or whatever.
Quote:Original post by xycsoscyx
But that won't produce acurate results all the time, will it? If I try to download a file in my app to test the speed, but the user is downloading something else and taking up all the bandwidth, then my download rate that I detect will be considerably off. The speed also depends on where I am downloading a file from, so if I'm downloading from a slow server, or the server just happens to be lagging, then my program might detect the connection as a modem speed, when it's really a lan or cable modem or whatever.

If the connection is slow, then you WANT to treat it as slow. It doesn't matter whether the slowness is the result of congestion or low bandwidth.
Forgetting about the reasoning, can I use the RasEnumConnections to determine the number of modem connections? I haven't used the Ras functions before (haven't even heard of them before actually), do they detect modem connections, or are there other connections that they might detect?

There is a more in depth reason why I am trying to detect modem users, but I might not need to ultimately. There are registry settings, but I don't know if they are reliable or not. Ultimately I just want to detect if a modem is being used or not, regardless of connection speed or whatnot. ATM I don't even care if they are getting less than 1kps on a T1. I was going to use some old school DirectConnect code, but I just noticed that it's no longer part of DX9 (not documented or supported any longer at least, I'm sure it's still there collecting dust in the source code though).

Thanks for the all the info, too.
Quote:Original post by xycsoscyx
Forgetting about the reasoning, can I use the RasEnumConnections to determine the number of modem connections? I haven't used the Ras functions before (haven't even heard of them before actually), do they detect modem connections, or are there other connections that they might detect?

They'll detect lots of different things; check out the docs for the szDeviceType field of RASENTRY to get a list.

This topic is closed to new replies.

Advertisement