EmotiBit / ofxEmotiBit

OpenFrameworks library and examples for the EmotiBit
MIT License
34 stars 8 forks source link

added internet access detection before version checking is performed #199

Closed nitin710 closed 6 months ago

nitin710 commented 1 year ago

Description

Requirements

Issues Referenced

Documentation update

None

Notes for Reviewer

Algorithm

Testing

Results

https://github.com/EmotiBit/ofxEmotiBit/pull/199#issuecomment-1847642355

OS sw version Network with internet network without internet no network
Expectation - (new version available notification + opens link to latest release) skips version check skips version check
win 1.8.1.fix-swVersionChecker.2 ✔️ ✔️ ✔️
osx 1.8.1.fix-swVersionChecker.2
linux 1.8.1.fix-swVersionChecker.2

Unit Tests

Unit tests performed (from EmotiBit Feature Test Protocols)

The corresponding results are recorded in the EmotiBit Software Testing Records sheet.

Steps to test

Shared files

Checklist to allow merge

Screenshots:

produceconsumerobot commented 1 year ago

Review 01

@nitin710 what OSes did you test this on? On Mac it seems like there may be a different message? image

@nitin710 I'm getting build errors that reference missing ofxLSL.cpp image Is it possible that you forgot to check-in the updated project file?

nitin710 commented 1 year ago
nitin710 commented 1 year ago

Successful ping outputs

linux

ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=18.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=25.7 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=54 time=14.5 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 14.503/19.471/25.685/4.649 ms

macOS ventura M1

ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=30.321 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=25.459 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=21.433 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 21.433/25.738/30.321/3.634 ms

macOS big sur (intel)

ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=21.199 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=19.552 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=25.092 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 19.552/21.948/25.092/2.323 ms

macOS mojave (intel)

ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=21.740 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=11.917 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=20.419 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 11.917/18.025/21.740/4.353 ms

macOS monterey (intel)

ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=24.305 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=14.307 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=15.809 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 14.307/18.140/24.305/4.402 ms

Windows


ping -n 3 8.8.8.8
Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=20ms TTL=54
Reply from 8.8.8.8: bytes=32 time=17ms TTL=54
Reply from 8.8.8.8: bytes=32 time=15ms TTL=54

Ping statistics for 8.8.8.8:
    Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 15ms, Maximum = 20ms, Average = 17ms```
nitin710 commented 1 year ago

Failed ping outputs

Linux (WiFi OFF)

ping: connect: Network is unreachable

macOS Ventura (Apple silicon) (WiFi OFF)

PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: No route to host

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss

macOS mojave (intel) (WiFi OFF)

PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: No route to host

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss

Windows (WiFi OFF)


C:\Users\nitin>ping -n 1 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 192.168.1.197: Destination host unreachable.

Ping statistics for 8.8.8.8:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), // NOTE THAT WE SOMEHOW got a packet back, BUT there was no internet access

C:\Users\nitin>ping -n 1 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 192.168.1.197: Destination host unreachable.

Ping statistics for 8.8.8.8:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),  // REPEATED experiment with same result

C:\Users\nitin>ping -n 2 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.197: Destination host unreachable. 

Ping statistics for 8.8.8.8:
    Packets: Sent = 2, Received = 1, Lost = 1 (50% loss), // sending more than 1 packet results in failure of 1

C:\Users\nitin>ping -w 2000 -n 3 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 8.8.8.8:
    Packets: Sent = 3, Received = 0, Lost = 3 (100% loss), // In this case, all 3 were lost. Hypothesis: It can be that all packets may be received erroneously? This will put us in the bucket of "internet connection exists", when there isn't any.

C:\Users\nitin>ping -n 3 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.197: Destination host unreachable.
Request timed out.

Ping statistics for 8.8.8.8:
    Packets: Sent = 3, Received = 1, Lost = 2 (66% loss), // Another random loss %

C:\Users\nitin>ping -n 1 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 192.168.1.197: Destination host unreachable.

Ping statistics for 8.8.8.8:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),  // ??

C:\Users\nitin>ping -w 100 -n 3 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 8.8.8.8:
    Packets: Sent = 3, Received = 0, Lost = 3 (100% loss),

C:\Users\nitin>ping -w 100 -n 1 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 192.168.1.197: Destination host unreachable.

Ping statistics for 8.8.8.8:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), // still reachable if pinging only once??

================NETWORK CONNECTED=============
C:\Users\nitin>ping -w 100 -n 1 8.8.8.8  

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=28ms TTL=54

Ping statistics for 8.8.8.8:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:     // This statement is only printed when the network exists
    Minimum = 28ms, Maximum = 28ms, Average = 28ms

Summary

nitin710 commented 1 year ago

Summary for the algorithm

For linux/macOS

nitin710 commented 12 months ago

Tested with

std::string testString =
        "PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.\n"
        "64 bytes from 8.8.8.8: icmp_seq = 1 ttl = 54 time = 18.2 ms\n"
        "64 bytes from 8.8.8.8 : icmp_seq = 2 ttl = 54 time = 25.7 ms\n"
        "64 bytes from 8.8.8.8 : icmp_seq = 3 ttl = 54 time = 14.5 ms\n"
        "-- - 8.8.8.8 ping statistics-- -\n"
        "3 packets transmitted, 3 received, 0 % packet loss, time 2003ms\n"
        "rtt min / avg / max / mdev = 14.503 / 19.471 / 25.685 / 4.649 ms";

    /*testString =
        "Pinging 8.8.8.8 with 32 bytes of data:\n"
        "Reply from 8.8.8.8: bytes = 32 time = 20ms TTL = 54\n"
        "Reply from 8.8.8.8 : bytes = 32 time = 17ms TTL = 54\n"
        "Reply from 8.8.8.8 : bytes = 32 time = 15ms TTL = 54\n"
        "Ping statistics for 8.8.8.8 :\n"
        "Packets : Sent = 3, Received = 3, Lost = 0 (0 % loss),\n"
        "Approximate round trip times in milli - seconds :\n"
        "Minimum = 15ms, Maximum = 20ms, Average = 17ms";*/

    /*testString =
        "PING 8.8.8.8 (8.8.8.8) : 56 data bytes\n"
        "ping : sendto: No route to host\n"

        "-- - 8.8.8.8 ping statistics-- -\n"
        "1 packets transmitted, 0 packets received, 100.0% packet loss";*/

    // Linux
    /*testString =
        "ping : connect: Network is unreachable";*/

    // Windows
    testString =
        "Pinging 8.8.8.8 with 32 bytes of data :\n"
        "Request timed out.\n"
        "Request timed out.\n"
        "Request timed out.\n"

        "Ping statistics for 8.8.8.8 :\n"
        "Packets : Sent = 3, Received = 0, Lost = 3 (100 % loss),\n";
nitin710 commented 12 months ago

Testing Matrix

OS sw version Network with internet network without internet no network
Expectation - (new version available notification + opens link to latest release) skips version check skips version check
win 1.8.1.fix-swVersionChecker.2 ✔️ ✔️ ✔️
osx 1.8.1.fix-swVersionChecker.2
linux 1.8.1.fix-swVersionChecker.2
produceconsumerobot commented 9 months ago

Review 02

@nitin710 review complete

nitin710 commented 9 months ago

Why are we looking for "time"? Looking at the examples, it seems like TTL/ttl is sufficient to separate success vs failed ping, no?

I could not find and dev comments explaining the reasoning. I think it was an attempt at "stricter check", but that is clearly not the case. Removed it from the checking.

nitin710 commented 8 months ago

This PR is already merged into dev. Will be merged to master once build on linux is resolved.