Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socketserver as soss
- import threading as th
- import socket as sock
- import testconnhandling as handler
- import testqueuemanager as qman
- cam = "cam!@#"
- keypad = "key!@#"
- motion = "mot!@#"
- controller = "con!@#"
- packetdelim = "&%&%("
- flag_internaldelim = "%^&*)"
- datadelim = "!&^%!"
- dictflag = "fdict"
- picflag = "fpic"
- newconflag = "fcon"
- commflag = "fcommd"
- # initializing the process/queue manager classes
- servermanager = qman.QueueManager()
- buffer = 8192
- #inconsequential
- def terminalprompt():
- print("terminal entered")
- while True:
- command = input(">")
- if command == "show":
- print(servermanager, "terminalprompt")
- print("current process dictionary \n", servermanager.procdict)
- else:
- if command != "":
- print(f"command '{command}' not found, use 'help' for information")
- class ThreadedTcpServer(soss.ThreadingMixIn, soss.TCPServer):
- pass
- if __name__ == "__main__":
- # addr defined
- host, port = "0.0.0.0", 6280
- # making the socket object and setting it to server forever
- with ThreadedTcpServer((host, port), handler.ConnHandler, bind_and_activate=False) as server:
- # server socket handler thread starting
- server.allow_reuse_address = True
- server.server_bind()
- server.server_activate()
- serverthread = th.Thread(target=server.serve_forever, args=(1,))
- serverthread.start()
- # terminal prompt start
- terminalprompt()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement