Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / September 2005

Tip: Looking for answers? Try searching our database.

connect to internet from a windows service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
@win - 25 Aug 2005 21:41 GMT
Hello,

I'm creating a windows service with VB.net. (vs 2003)
I want this service to connect (or check the status of the connection) to
the internet via a ISDN modem connection (standard dailup) without a logged
in user.
The service is running on a windows XP embedded OS.

Can anyone point me in the right direction with this, I have no idea where
to start on this on

Thanks in for your reply

Regards, @win
Cor Ligthert [MVP] - 26 Aug 2005 07:38 GMT
Win,

In my idea simple, with a modem connection you should have a provider who
handles your connection and therefore you should have a user and a password.

I hope this helps,

Cor,
@win - 26 Aug 2005 08:11 GMT
Hi Cor, Thanks for your response.

This is not really the problem. Let say the dailup connection was already
configured and ready to connect. What I want to do now is to let the windows
service (no logged in user) connect to the internet (at boot, or when
connection was lost)

The machine is running in an remote location and does not have a user
(headless system). I need this system to dump some data every 15 minutes to a
webservice.
Before it can do that it needs a connection via the ISDN line. therfore i
need to setup a routine that prior to dumping the data checks the status of
the connection, and if lost reestablishes it.

Thanks for your help
Signature

Regards, @win

> Win,
>
[quoted text clipped - 4 lines]
>
> Cor,
Cor Ligthert [MVP] - 26 Aug 2005 08:23 GMT
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
@win - 28 Aug 2005 11:27 GMT
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,

Signature

Regards, @win

> Win,
>
[quoted text clipped - 27 lines]
>
> Cor
hB - 05 Sep 2005 04:30 GMT
WinINet dial-up functions
InternetAutodial
InternetAutodialHangup
InternetDial
InternetGetConnectedState
InternetHangUp
InternetGoOnline

VisualBasic
http://www.vbip.com/wininet/wininet_connection_01.asp
http://www.vbip.com/wininet/wininet_dialup.asp

simple sample c#
http://www.aspemporium.com/howto.aspx?hid=34

RAS Library in Dotnet
http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=dd3ebd3e-684a-4dde-a843-e5
fdb0895b8e


---
hB
@win - 07 Sep 2005 01:14 GMT
Thanks hb,

This is what i need.
Signature

Regards, @win

> WinINet dial-up functions
> InternetAutodial
[quoted text clipped - 16 lines]
> ---
> hB

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.