Initial Commit

This commit is contained in:
Vividh Mariy
2020-04-11 18:42:11 +05:30
commit 9a2ebbd78e
2 changed files with 27 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
venv
.vscode

25
paster.py Normal file
View File

@@ -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()