summaryrefslogtreecommitdiff
path: root/ping.py
diff options
context:
space:
mode:
authorSanjit Bhat <[email protected]>2023-10-26 06:44:48 -0400
committerSanjit Bhat <[email protected]>2023-10-26 06:44:48 -0400
commitcfae93475dfb4cb5cfe264f4c029136e1447c262 (patch)
tree699903e093e3a23caf7ce3899e7c80e48511f900 /ping.py
parent1ed40716eb54e371df9d1814b9129666b3fe4f09 (diff)
downloadxv6-labs-cfae93475dfb4cb5cfe264f4c029136e1447c262.tar.gz
xv6-labs-cfae93475dfb4cb5cfe264f4c029136e1447c262.tar.bz2
xv6-labs-cfae93475dfb4cb5cfe264f4c029136e1447c262.zip
net add missing files
Diffstat (limited to 'ping.py')
-rw-r--r--ping.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ping.py b/ping.py
new file mode 100644
index 0000000..eab10f8
--- /dev/null
+++ b/ping.py
@@ -0,0 +1,12 @@
+import socket
+import sys
+import time
+
+sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+addr = ('localhost', int(sys.argv[1]))
+buf = "this is a ping!".encode('utf-8')
+
+while True:
+ print("pinging...", file=sys.stderr)
+ sock.sendto(buf, ("127.0.0.1", int(sys.argv[1])))
+ time.sleep(1)