Skip to content

Commit

Permalink
Update main.py - fun features
Browse files Browse the repository at this point in the history
  • Loading branch information
BenChanlLOL authored May 10, 2024
1 parent 23ae2ac commit bfa6c3d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@

import socket
from sys import argv
import sys
import webbrowser
import time


if argv:
if len(argv) == 2:
print("no arguments are required")
sys.exit()


#pre defined variables
sock = socket.socket()
serverOn = False

while True:
address1 = input("what ip should we connect to? ")
Expand Down Expand Up @@ -44,14 +48,25 @@
print("done")
elif cmd == "bind":
try:
for n in range(0,5):
print(n)
time.sleep(1)
sock.bind((socket.gethostname(), 7092))
serverOn = True
print("starting on port 7092")
print("server started")
except OSError as e:
print("Error occurred while binding socket: " + str(e))
print("\n")
print("perhaps run the program as sudo")
print("or restart the program and, when prompted for a ip and port to connect to say 'ignore'")
elif cmd == "status":
if serverOn:
print("server is running")
print("All services are succesful")
print("CODE: 0")
else:
print("server is not running")
elif cmd == "connect":
while True:
print("client started or message sent")
Expand Down

0 comments on commit bfa6c3d

Please sign in to comment.