Release The Mini Slug Project


TrashyMG

Sarcasm Dispenser
Staff member
Joined
Jan 18, 2010
Messages
10,839
I use "iwconfig | grep -q Link", but that's probably not the best way.
I believe iwconfig is specific to just wireless networking, what if people used a USB ethernet adapter and what not.
I found this to be pretty reliable, found it on a quick google search. swap the google.com host name with the hostname comp4all talks to and it should be a good indicator.

Code:
#!/bin/bash
host google.com>/dev/null
if [  $? -eq 0 ];
then  
  echo "Internet connection is UP"
else
  echo "Internet connection is DOWN"
fi
this can be a little slow (10S or so) if ran without a network connection so perhaps throwing a zenity progress bar would be good. Despite it being slow I think it would be more valid of a check, what if you had an internet connection, just the path to the server is down or blocked.
 
Last edited by a moderator:

_wb_

Microbe
Staff member
Joined
Apr 5, 2012
Messages
5,390
Age
39
Location
Brussels, Belgium
What if your DNS server is down but skeezix' C4A server is still reachable? Just kidding ;)

Maybe a better way is to do "ifconfig | grep Bcast", or to get some information from route, netstat, or /proc/net/.
 

TrashyMG

Sarcasm Dispenser
Staff member
Joined
Jan 18, 2010
Messages
10,839
Well, It is pretty quick with a working internet connection...

But that may just work too.
 
Last edited by a moderator:

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,789
Age
48
Location
France, near Lyon
So, TrashMG solution is only valid at launch of PND, where I can see if network is UP, send defered score if any, or warn user about no network. _wb_ solution should be faster to execute. I send score each time a new score is done, so I prefer faster checks. I can also probably use both solution, the slow but accurate at start, the fast in the run. I don't know.

I still find it better if the "sc" client handle that itself (call me lazzy), but even if the "sc" client send error code, we have to be sure to interpret codes the right way, or chances of duplicate upload are big.
 

Neelix

Insecticidal Maniac
Joined
Jan 8, 2011
Messages
3,260
Location
Melbourne, Australia
What if your DNS server is down but skeezix' C4A server is still reachable? Just kidding ;)

Maybe a better way is to do "ifconfig | grep Bcast", or to get some information from route, netstat, or /proc/net/.
Correct me if I'm wrong but since the C4A server is a virtual webserver sharing an IP with several other virtual webservers, wouldn't it be checking the subdomain name the request is addressed to to determine which internal port to connect to?  And wouldn't that effectively mean that if the DNS server is down then the server isn't reachable?    :)

- Neelix
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,789
Age
48
Location
France, near Lyon
Updated the C4A support to use the --cache parameter, so result are saved if offline (and uploaded at next upload of any score using Fusilli client)

v2.0.1.07

  • Using Fusilli client from Ziz, with cached upload
 

Ziz

Advanced Member
Joined
Jan 15, 2006
Messages
3,584
Works great, especially the caching. I may be the worst person ever on this game. :)
 
Last edited by a moderator:

Ziz

Advanced Member
Joined
Jan 15, 2006
Messages
3,584
Works great, especially the caching. I may be the worst person ever on this game. :)
That cache concept is great by the way, especially with more and more software using it :)
Nice to hear!
You can now submit all cached score with the Sparrow C4A Manager, too.

So you play offline (saves energy!), goes online, uses the Sparrow C4A Manager to submit the cached scores and goes offline again. :D
 
Last edited by a moderator:

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,789
Age
48
Location
France, near Lyon
New build with updated fuzilli client that fix issue with large score cache

v2.0.1.08

  • Updated Fusilli client from Ziz, with fixed cached upload for large cache
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
8,789
Age
48
Location
France, near Lyon
New build, with c4a-flood prevention.

v2.0.1.09

  • Improved C4A using newest fusilli client: only best scores of the session will be send
 
Top