add sourcecode
This commit is contained in:
Binary file not shown.
8
04/client.py
Normal file
8
04/client.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import socket
|
||||
|
||||
sock_ = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
||||
sock_.connect((socket.gethostname(),9337))
|
||||
msg = sock_.recv(1024)
|
||||
sock_.close()
|
||||
print(msg.decode("ascii"))
|
||||
|
||||
18
04/server.py
Normal file
18
04/server.py
Normal 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()
|
||||
Reference in New Issue
Block a user