Sep-04-2018, 06:33 AM
I have the following block of code which i use to Ping multiple addresses
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'
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'