Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
135 user(s) are online (130 user(s) are browsing Forums)

Members: 0
Guests: 135

more...

Support us!

Headlines

 
  Register To Post  

Check for internet
Just popping in
Just popping in


See User information
Is there a good/preferred way to check for internet connection?

Everything I have tried, if there isn't a connection, will "lock" the system for 30 seconds while checking for NIC card and such. Not good.

Go to top
Re: Check for internet
Amigans Defender
Amigans Defender


See User information
@mritter0

Hmm...

The old way was to open bsdsocket.library. If it failed, there was no TCP/IP stack running.

You can't do that on OS4, but when you call connect() it should return an error straight away.

I've never noticed anything freezing, however the program you are running may pause waiting for a timeout.

Go to top
Re: Check for internet
Just can't stay away
Just can't stay away


See User information
@mritter0
You could try entering C:GetNetStatus in a shell.

Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top
Re: Check for internet
Home away from home
Home away from home


See User information
@mritter0

Well the network is up all the time in loopback mode (at least notmally, I don't if there is way to prevent that).

You might be able to query the routing lists via GetRouteInfo() to find out if the machine is on the LAN, (or perhaps some other API function I missed) , Ranger can show the configured interface so that may be possible, but I don't think you can work out if the router is then connected to the internet without at least pinging a remote address.


Go to top
Re: Check for internet
Just can't stay away
Just can't stay away


See User information
Can't you use shownetstatus? it'll tell you what the default gateway address is. If it's 0.0.0.0 then there is probsbly no internet.

Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top
Re: Check for internet
Just can't stay away
Just can't stay away


See User information
In my S:Network-Status, after the AddNetInterface line, I have the following:
Wait 5 SECS

GetNetStatus CHECK INTERFACES
,RESOLVER,DEFAULTROUTE
If WARN
  Wait 3 
Increase chances of IPrefs having opened the final WB screen
  RequestChoice 
"Network Startup" "Network not operational,*nS:Network-Startup aborted" "OK"
  
Quit
EndIf
It's probably not fully failsafe, but it usually does the trick for me.

Play around with the lengths of the Wait commands if needed.

Best regards,

Niels



Go to top
Re: Check for internet
Just popping in
Just popping in


See User information
Thanks for the script ideas. But this is in the development forum. Looking for C code.

Workbench Explorer - A better way to browse drawers
Go to top
Re: Check for internet
Home away from home
Home away from home


See User information
@mritter0
Everything you need to know is in the bsdsocket.library autodoc

Some suggestions for reading.

ObtainInterfaceList()

If no interfaces have been added you can't be online, and vice verca.

If you need more info perhaps look at

QueryInterfaceTagList()

Can't give you code examples as I've never done it.

Go to top
Re: Check for internet
Just can't stay away
Just can't stay away


See User information
@mritter0
If you're looking for examples you could visit https://github.com/jens-maus/yam and look at src/tcp/Connection.c to see if that helps.

Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top
Re: Check for internet
Just popping in
Just popping in


See User information
why not just send a "ping" to a server you know and wait a little time for an answer ? if network is up you will get a ping back from the site, if network is down you will get an instant error.

Amigalement,
Jean-Francois Bachelet, Amiga nuts since 1985
-----------------------------------------------------------
Welcome to Happy Computing : AMIGA! (C)2K4-2K99 voxel
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project