PC Review


Reply
Thread Tools Rate Thread

Computer Online ?

 
 
RS
Guest
Posts: n/a
 
      3rd Sep 2003
Is there a function that will tell you if your computer is
online to the internet ?


 
Reply With Quote
 
 
 
 
William Ryan
Guest
Posts: n/a
 
      3rd Sep 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there a function that will tell you if your computer is
> online to the internet ?
>
>



 
Reply With Quote
 
William Ryan
Guest
Posts: n/a
 
      3rd Sep 2003
Two come to mind

Dim webRequestor As HttpWebRequest

Dim webResponder As HttpWebResponse

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

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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there a function that will tell you if your computer is
> online to the internet ?
>
>



 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      4th Sep 2003
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Online Degrees, Online Colleges and Universities, Online Courses andEducation, Online Distance Learning Migrate Expert Microsoft Access 0 12th Apr 2008 09:40 AM
Where to buy computer screws online? brundlefly76@hotmail.com Computer Hardware 9 18th Feb 2007 07:37 AM
computer is crashing when i go online conecx Windows XP Help 4 21st Nov 2006 07:24 PM
Computer Vitals - Your Online Computer Helpline my.chat.friends@gmail.com Microsoft Access Form Coding 2 17th Sep 2006 08:12 PM
can anyone fix my computer from online? =?Utf-8?B?Ojp7MjBEMDRGRTAtM0FFQS0xMDY5LUEyRDgtMDgw Microsoft Access 1 24th Aug 2005 12:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:11 PM.