commit 9a2ebbd78e6bd1d55692bbcc6d931335f1615b57 Author: Vividh Mariy Date: Sat Apr 11 18:42:11 2020 +0530 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e75ccaa --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +venv +.vscode diff --git a/paster.py b/paster.py new file mode 100644 index 0000000..dd395ed --- /dev/null +++ b/paster.py @@ -0,0 +1,25 @@ +import socket + +port = 1234 +url = "https://static.magnum.wtf/" + + +# create the socket +# AF_INET == ipv4 +# SOCK_STREAM == TCP +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + +# reserve and litsen for requests on $port +s.bind((socket.gethostname(), 1234)) + +# set a queue depth of 10, since we can handle just one connection at a time + + + +# Listen indefinetly +while True: + # now our endpoint knows about the OTHER endpoint. + clientsocket, address = s.accept() + print(f"Connection from {address} has been established.") + clientsocket.send(bytes("Hey there!!!","utf-8")) + clientsocket.close() \ No newline at end of file