Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ping Code Problem
#1
I have the following block of code which i use to Ping multiple addresses

        AN_Sel_State = var4.get()
        if (AN_Sel_State == 1):
            if(s.call(["ping", Output_IP_Address_AN])==0):
                    print("'Ping' Sucessful")
                    IPT_Display_AN = Label(IPT, text=(Output_IP_Address_AN, "Ok"),fg='green', anchor=W)
                    IPT_Display_AN_Window = canvas_IPT.create_window(150, 235, anchor = 'sw', window = IPT_Display_AN)
            else:
                    print("'Ping' NOT Sucessful")
                    IPT_Display_AN = Label(IPT, text=(Output_IP_Address_AN, "Failed"),fg='red', anchor=W)
                    IPT_Display_AN_Window = canvas_IPT.create_window(150, 235, anchor = 'sw', window = IPT_Display_AN)
This works as expected in instances were packet data is received (Succesful) and also works when 'Request timed out' (Not Succesful) however when 'Host Unreachable' it returns the result is successful which is wrong.

I cant seem to work out what my mistake is the return should be ==1 in both instances of 'Request timed out' and 'Host Unreachable'
Reply


Messages In This Thread
Ping Code Problem - by MTom5 - Sep-04-2018, 06:33 AM
RE: Ping Code Problem - by MTom5 - Sep-04-2018, 09:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need some guidance on a script to ping a list of ip's cubangt 11 1,910 Aug-10-2023, 02:39 PM
Last Post: snippsat
  non-stop ping script kucingkembar 1 1,385 Aug-23-2022, 06:29 AM
Last Post: menator01
  Win32\ping.exe windows pops up -very annoying... tester_V 9 3,294 Aug-12-2021, 06:54 AM
Last Post: tester_V
  Looking for discord bot to make loop ping for address ip tinkode 0 1,844 Jul-26-2021, 03:51 PM
Last Post: tinkode
  Ping command using python 3.6.5 Martin2998 6 17,502 Apr-19-2021, 06:24 PM
Last Post: blazejwiecha
  GPIO high if network IP has good ping duckredbeard 3 2,380 Oct-12-2020, 10:41 PM
Last Post: bowlofred
  Create a program that PING a list of IPs skaailet 7 6,448 Mar-26-2020, 10:46 PM
Last Post: snippsat
  ping with output jacklee26 1 4,972 Nov-28-2019, 01:01 PM
Last Post: Axel_Erfurt
  PING PONG GAME akea 0 5,721 May-08-2019, 04:30 PM
Last Post: akea
  ping and pong run both well sylas 1 3,199 Sep-24-2017, 05:14 PM
Last Post: sylas

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020