Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 10th March 2006, 12:32   #1
java.jago
Junior Member
 
Join Date: Mar 2006
Posts: 4
Function InternetConnect from NSIS Documentation doesn't work!

Hi,

Function InternetConnect from NSIS Documentation doesn't work!

The problem is: the function thinks I am connected to the internet - althought I am definetily not!

Does anybody know a solution (perhaps demonstrated with a short script) how to determine if the user is online - and if he isn't ask him in a loop to do so ?

Cheers,
jago
java.jago is offline   Reply With Quote
Old 10th March 2006, 13:33   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The documentation doesn't contain any function named InternetConnect. Are you talking about ConnectInternet from the Dialer plug-in's documentation?

That function uses wininet's InternetAttemptConnect. It seems this function settles for an active Ethernet connection and only fires up the dialer, if only a modem is connected to the system. You can find more discussion about this at:

http://groups.google.com/group/micro...19c40bd1692c2e

Checking for an internet connection isn't simple, especially with many connection methods floating around and firewalls that can block your pings. Your best test will be to mimic the actual process you want to perform, in a smaller form. For example, if you want to download a big file from your website, download a very small file from the same server for testing.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 10th March 2006, 13:35   #3
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Hmmm.

I think the example from the documentation does not take into account that you can have a private IP, and still not be "online" (to the internet).

This is a little big, but it may do the job. Basically, you could check to see if they have one of four types of IPs:

1) a loopback IP (127.0.0.1): not online.
2) no-dhcp ip: 169.254.x.x: not online.
3) a private IP (192.168.x or whatever): maybe online.
4) a normal IP (64.28.x.x): online

So in cases 1 and 2, they are not online. In case 3, they are possibly online - you could try pinging google.com for a reply, maybe. And in case 4, they are online.

It's a little bulky for what you're trying to do, though. Maybe there is a simpler solution.
Jamyn is offline   Reply With Quote
Old 4th January 2007, 18:47   #4
sag47
Member
 
Join Date: Dec 2006
Posts: 50
Send a message via AIM to sag47
InternetConnect function fixed

Here is a fixed function for InternetConnect in the Dialer documentation. It is actually better than the example provided because it allows the user to retry to connect. I've attached a script example using it as well.

I used it to program an updater for my software UHARC CMD.
Get it at http://www.pages.drexel.edu/~sag47/uharc

I provide the source with it and it includes a ton of NSIS script examples that can help you write your own software.
SAM

I believe this is what you are looking for.
code:

Function InternetConnect
Start:
; Check for internet Connection
Push $R0
Dialer::GetConnectedState
Pop $R0
StrCmp $R0 "online" connected
MessageBox MB_RETRYCANCEL|MB_TOPMOST|MB_SETFOREGROUND|MB_ICONEXCLAMATION "Can't connect to internet!" idRetry Start
Quit ;Remove to make error not fatal
connected:
Pop $R0
FunctionEnd


Keywords:
Detect internet connection
Detect internet
Detect connection
check for internet connection
check for internet
check for connection
dialer plugin
dialer
dialer internetconnect
dialer internetconnect function
getconnectedstate
dialer::getconnectedstate
nsisdl plugin
nsisdl check internet first
Attached Files
File Type: zip internetconnect.zip (8.0 KB, 245 views)
sag47 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump