We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8b906f commit 29143f0Copy full SHA for 29143f0
simple-server/README.md
@@ -0,0 +1,5 @@
1
+# Simple Server
2
+
3
+A simple server program
4
5
+This example is giving information.
simple-server/simple-server.py
@@ -0,0 +1,24 @@
+import socket
+import sys
+with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
+ server.bind(("", 23))
6
7
+ server.listen(1)
8
9
+ print("The server has been started.")
10
11
+ connection, address = server.accept()
12
13
+ with connection:
14
+ print("A client has been connected.")
15
16
+ connection.sendall(b"Hello, World!\n")
17
18
+ while True:
19
+ string = connection.recv(1)
20
21
+ connection.close()
22
+ print("A connection closed.")
23
24
+ sys.exit()
0 commit comments