473,382 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Computer Online ?

RS
Is there a function that will tell you if your computer is
online to the internet ?
Nov 20 '05 #1
3 1139
There are two way that come to mind

//Using WinAPI - make sure you use Runtime.Interopservices
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( int out Description,
int ReservedValue ) ;

public static bool IsConnected( )
{

int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;

}

or this way...

"RS" <rl*****@worldnet.att.net> wrote in message
news:Oy**************@TK2MSFTNGP11.phx.gbl...
Is there a function that will tell you if your computer is
online to the internet ?

Nov 20 '05 #2
Two come to mind

Dim webRequestor As HttpWebRequest

Dim webResponder As HttpWebResponse

Dim url As String = ConfigurationSettings.AppSettings.Item("url").ToSt ring

Try

webRequestor = CType(WebRequest.Create(url), System.Net.HttpWebRequest)

webResponder = CType(webRequestor.GetResponse, System.Net.HttpWebResponse)

If webResponder.StatusCode = HttpStatusCode.OK Then

Return True

Or using the winAPI

Make sure you include Runtime.InteropServices;

[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( int out Description,
int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnected( )
{

int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;

}

"RS" <rl*****@worldnet.att.net> wrote in message
news:Oy**************@TK2MSFTNGP11.phx.gbl...
Is there a function that will tell you if your computer is
online to the internet ?

Nov 20 '05 #3
Hi William,

Thanks for that. I've wondered myself.

MSDN says that InternetGetConnectedState() will tell me whether there's a
(default) connection or not. Do you know how I can tell more, eg, what's
flowing on it - ie, whether there's an incoming stream or anything outgoing
from other applications ?

Thanks,
Fergus
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Mickel Grönroos | last post by:
Hi all, I have a silly question. Is there are simple way to check if the computer is connected to the Internet? It seems this should be a pretty straight-forward thing to do, but as I am totally...
5
by: Greg Cyrus | last post by:
Hi, i recently joined an online.game which rules is not to use 2 diffenrent accounts on one computer. My girlfriend also wants to play - but we got 1 computer only - so I tried to trick the...
4
by: lgbjr | last post by:
Hi All, I need to retrieve a list of computer names that are available on a network and a list of databases that are available in MSDE2K. Can someone point me in the right direction for...
2
by: computer vitals | last post by:
http://computervitals.com Hey guyz, I welcome you to Computer Vitals, Your Online Computer Helpline. A new venture to help people with all sides of software and hardware. Pay a visit and...
6
by: MattPKaiser | last post by:
I am trying to find a way to check if a computer on a network is "online" so that I can access a file on a share. In short I maintain a list of computers that have my service running (in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.