Beispiel #1
0
 def connect(self, uid, seuid):
     mySql = sql.getMySql().connect()
     cur = mySql.cursor()
     cur.execute("select uid,port from user where uid='%s'" % (seuid))
     result = cur.fetchone()
     cur.close()
     mySql.close()
     self.seport = result[1]
     self.myuid = seuid
     #th=threading.Thread(target=self.__recv_thread,args=(uid,seuid,))
     #th.start()
     th = threading.Thread(target=self.__show_thread)
     th.start()
     vserver = Video_Server((self.seport + 1), 4)
     aserver = Audio_Server((self.seport + 2), 4)
     vserver.start()
     aserver.start()
     mySql = sql.getMySql().connect()
     cur = mySql.cursor()
     cur.execute("select uid,port from user where uid='%s'" % (uid))
     result = cur.fetchone()
     cur.close()
     mySql.close()
     self.toport = result[1]
     print(self.seport, self.toport)
Beispiel #2
0
 def __init__(self, port, label, version=4):
     '''
     port:服务绑定端口号
     label:视频显示控件
     version:IPV4或IPV6
     '''
     self.vserver = Video_Server(port, label, version)
     self.stop_vserver = self.vserver.stop_vserver
     self.aserver = Audio_Server(port + 1, version)
     self.stop_aserver = self.aserver.stop_aserver
     self.vserver.start()
     self.aserver.start()
Beispiel #3
0
def func():
    vclient = Video_Client(IP, PORT, SHOWME, LEVEL, VERSION)
    vserver = Video_Server(PORT, VERSION)
    aclient = Audio_Client(IP, PORT + 1, VERSION)
    aserver = Audio_Server(PORT + 1, VERSION)
    vclient.start()
    vserver.start()
    aclient.start()
    aserver.start()
    while True:
        time.sleep(1)
        if not vserver.isAlive() or not vclient.isAlive():
            print("Video connection lost...")
            #sys.exit(0)
        if not aserver.isAlive() or not aclient.isAlive():
            print("Audio connection lost...")
Beispiel #4
0
parser.add_argument('--sversion', type=int, default=4)
# parser.add_argument('--rhost', type=str, default='127.0.0.1')
# parser.add_argument('--rport', type=int, default=10087)
# parser.add_argument('--rversion', type=int, default=4)
parser.add_argument('--noself', type=bool, default=False)
parser.add_argument('--level', type=int, default=1)

args = parser.parse_args()

sIP = args.shost
sPORT = args.sport
sVERSION = args.sversion
# rIP = args.rhost
# rPORT = args.rport
# rVERSION = args.rversion
SHOWME = args.noself
LEVEL = args.level

if __name__ == '__main__':
    vclient = Video_Client(sIP, sPORT, sVERSION, SHOWME, LEVEL)
    vserver = Video_Server(sIP, sPORT + 1, sVERSION)
    vclient.start()
    vserver.start()
    while True:
        time.sleep(1)
        if not vserver.isAlive() or not vclient.isAlive():
            print("Video connection lost...")
            sys.exit(0)
        # if not aserver.isAlive() or not aclient.isAlive():
        #     print("Audio connection lost...")
        #     sys.exit(0)
Beispiel #5
0
parser.add_argument('--host', type=str, default='127.0.0.1')
parser.add_argument('--port', type=int, default='8888')
parser.add_argument('--level', type=int, default=1)
parser.add_argument('-v', '--version', type=int, default=4)

args = parser.parse_args()

IP = args.host
PORT = args.port
VERSION = args.version
LEVEL = args.level

if __name__ == '__main__':
    vclient = Video_Client(IP, PORT, LEVEL, VERSION)
    vserver = Video_Server(PORT, VERSION)
    aclient = Audio_Client(IP, PORT + 1, VERSION)
    aserver = Audio_Server(PORT + 1, VERSION)
    vclient.start()
    aclient.start()
    time.sleep(1)
    vserver.start()
    aserver.start()
    while True:
        time.sleep(1)
        if not vserver.isAlive() or not vclient.isAlive():
            print("Video connection lost...")
            sys.exit(0)
        if not aserver.isAlive() or not aclient.isAlive():
            print("Audio connection lost...")
            sys.exit(0)
Beispiel #6
0
 def __init__(self, ip):
     PORT = 11111
     self.vclient = Video_Client(ip, PORT, 1, 4)
     self.vserver = Video_Server(PORT - 1, 4)
     self.aclient = Audio_Client(ip, PORT + 1, 4)
     self.aserver = Audio_Server(PORT + 2, 4)