summaryrefslogtreecommitdiff
path: root/ping.py
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-14 20:46:23 +0800
committerMole Shang <[email protected]>2024-02-14 20:46:23 +0800
commitf98eeb30507040dc916b2a337818830954ee1d4a (patch)
treea741cb0bbd6be96d8084e72b4af895ac093a2b48 /ping.py
parent0de5ac779602f562a038e5ad27163d85bc71638b (diff)
parent904885a96efd1dd0221585f67477f5a39bcce7f7 (diff)
downloadxv6-labs-f98eeb30507040dc916b2a337818830954ee1d4a.tar.gz
xv6-labs-f98eeb30507040dc916b2a337818830954ee1d4a.tar.bz2
xv6-labs-f98eeb30507040dc916b2a337818830954ee1d4a.zip
Merge branch 'net' into lock
Conflicts: .gitignore Makefile conf/lab.mk kernel/defs.h user/user.h
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)