add sourcecode

This commit is contained in:
Jimmy Xiang
2020-11-12 17:02:10 +08:00
parent bf7c50956c
commit f698082a29
23 changed files with 2746 additions and 0 deletions

18
04/server.py Normal file
View File

@@ -0,0 +1,18 @@
import socket
host = socket.gethostname()
port = 9337
sock_ = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock_.bind((host,port))
sock_.listen(1)
print("\nServer started...\n")
conn,addr = sock_.accept()
print("Connection established with: ",str(addr))
message = "\nThank you for connecting "+str(addr)
conn.send(message.encode("ascii"))
conn.close()