-
Notifications
You must be signed in to change notification settings - Fork 0
/
Server.py
30 lines (21 loc) · 709 Bytes
/
Server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
__author__ = 'Tibbers'
import sys, socket
from ServerWorker import ServerWorker
class Server:
def main(self):
try:
SERVER_PORT = int(sys.argv[1])
except:
print "[Usage: Server.py Server_port]\n"
rtspSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
rtspSocket.bind(('', SERVER_PORT))
print "RTSP Listing incoming request..."
rtspSocket.listen(5)
# Receive client info (address,port) through RTSP/TCP session
while True:
clientInfo = {}
clientInfo['rtspSocket'] = rtspSocket.accept() # this accept {SockID,tuple object},tuple object = {clinet_addr,intNum}!!!
ServerWorker(clientInfo).run()
# Program Start Point
if __name__ == "__main__":
(Server()).main()