Python Forum
Test internet connection
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Test internet connection
#11
(Oct-13-2016, 02:54 PM)micseydel Wrote: I ping 8.8.8.8, since it's a DNS server and tends to be very reliable.

How do you ping with python? Scapy?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
#12
(Oct-13-2016, 02:54 PM)micseydel Wrote: I ping 8.8.8.8, since it's a DNS server and tends to be very reliable.

2001:4860:4860::8888 is the same machine.

(Oct-13-2016, 03:10 PM)wavic Wrote:
(Oct-13-2016, 02:54 PM)micseydel Wrote: I ping 8.8.8.8, since it's a DNS server and tends to be very reliable.

How do you ping with python? Scapy?

another way is with subprocess.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
#13
(Oct-13-2016, 11:40 PM)Skaperen Wrote:
(Oct-13-2016, 02:54 PM)micseydel Wrote: I ping 8.8.8.8, since it's a DNS server and tends to be very reliable.

2001:4860:4860::8888 is the same machine.

(Oct-13-2016, 03:10 PM)wavic Wrote:
(Oct-13-2016, 02:54 PM)micseydel Wrote: I ping 8.8.8.8, since it's a DNS server and tends to be very reliable.

How do you ping with python? Scapy?

another way is with subprocess.
I don't like to use subprocess.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
#14
(Oct-14-2016, 02:18 AM)wavic Wrote: I don't like to use subprocess.
is there some knowledge base around this that i do not have?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
#15
(Oct-14-2016, 03:08 AM)Skaperen Wrote:
(Oct-14-2016, 02:18 AM)wavic Wrote: I don't like to use subprocess.
is there some knowledge base around this that i do not have?
Yes subprocess is top secret stuff :silenced: 
import subprocess

website = "google.com"
ping = subprocess.Popen(["ping", website], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, error = ping.communicate()
print(out.decode('utf-8'))
Output:
Pinging google.com [193.212.4.59] with 32 bytes of data: Reply from 193.212.4.59: bytes=32 time=14ms TTL=60 Reply from 193.212.4.59: bytes=32 time=13ms TTL=60 Reply from 193.212.4.59: bytes=32 time=12ms TTL=60 Reply from 193.212.4.59: bytes=32 time=11ms TTL=60 Ping statistics for 193.212.4.59:     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:     Minimum = 11ms, Maximum = 14ms, Average = 12ms


Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter - Random Quote from internet menator01 0 186 Apr-02-2024, 07:44 PM
Last Post: menator01

Forum Jump:

User Panel Messages

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