Hi Cor, thanks again for your response
Yes I could do that but determining the status of the connection is not the
only thing that I need to do. Also If I use your approach or an Exeption
handler (when trying to connect to the webservice) than that does not realy
say anything about the status of the connection , A server on the internet
could be down and I still could be connected to the internet.
With the status of the connection I need to determine if I have to reconnect
to the internet throught a dailup connection yes or no.
For me the real challenge is to get a dailup connection profile to reconnect
to the internet from my code (windows service, no logged in user). I have
found out that you can use the RAS API and PInvoke to do that, but this is
all in C++, not really my cup of tea.
I hope you understand my problem and that you have any other Ideas, Thanks
again for your thoughts,
--
Regards, @win
"Cor Ligthert [MVP]" wrote:
Win,
Sorry, I was talking from a webservice. What you want to do is a simple ping
to an external server. And for that I know only a commandline solution which
you cannot use.
Can you maybe do something with this one. It is a sample how to get the page
from Google, however what you get is of course not important.
Using this class you can as well get server information. However this is a
very nice short sample.
\\\
Module main
Public Sub main()
Dim myReg As Net.HttpWebRequest = _
DirectCast(Net.WebRequest.Create("http://www.google.com"), _
Net.HttpWebRequest)
Dim myResp As Net.HttpWebResponse = _
DirectCast(myReg.GetResponse(), Net.HttpWebResponse)
Dim myStream As IO.Stream = myResp.GetResponseStream()
Dim myreader As New IO.StreamReader(myStream)
Dim mystring As String = myreader.ReadToEnd()
myResp.Close()
End Sub
End Module
///
I hope this helps a little bit?
Cor