Exemple #1
0
def Login():
    print "------------------------Test Login--------------------------------"

    print "Input platform: (i for ios, a for android, other for default):"
    line = sys.stdin.readline()
    comm.gl_platform = line[:-1]

    if comm.gl_platform != 'i' and comm.gl_platform != 'a':
        print "login use default user: "******"Input uid:"
        line = sys.stdin.readline()
        comm.gl_uid = string.atoi(line[:-1])

        print "Input cid:"
        line = sys.stdin.readline()
        comm.gl_cid = line[:-1]

        print "Input password:"******"Input appkey:"
        line = sys.stdin.readline()
        comm.gl_appkey = line[:-1]

    (errCode, strJson) = conn_test_com.TcpLogin(comm.gl_uid, comm.gl_cid,
                                                comm.gl_password,
                                                comm.gl_appkey, s)
    print "login code:", errCode
    print "json:", strJson
    reto = json.loads(strJson)
    print reto

    comm.gl_uid = reto[u'uid']
    comm.gl_sid = reto[u'sid']
Exemple #2
0
import StringIO
import socket
import conn_test_com
import time
import json
#C->S:
#    sContent = dwUin+dwType+wLen+K(dwUin+strmd5(passwd)+ dwStatus + strReserved)
#S->C:
#    sContent = cResult + stOther

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

(errCode,
 strJson) = conn_test_com.TcpLogin(100149, 'IMUser167',
                                   '96e79218965eb72c92a549dd5a330112',
                                   '00b6413a92d4c1c84ad99e0a', s)
print "login code:", errCode
print "json:", strJson

reto = json.loads(strJson)
print reto

sid = reto[u'sid']

#(errCode, strjson)  = conn_test_com.TcpSetUserInfo(100033, sid, s, "", "Hello imsdk", "By aimen xinxi keji youxian gongsi")
#print "hello code:", errCode
#print "json:", strjson

#(errCode, strjson)  = conn_test_com.TcpGetUserInfo(100033, sid, s)
#print "get user info code:", errCode
Exemple #3
0
import StringIO
import socket
import conn_test_com
import time
import json
#C->S:
#    sContent = dwUin+dwType+wLen+K(dwUin+strmd5(passwd)+ dwStatus + strReserved)
#S->C:
#    sContent = cResult + stOther

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

uid = 100165

(errCode, strJson) = conn_test_com.TcpLogin(uid, "*****@*****.**", 'test',
                                            'ahdjfhasjdfhaksdjfh324adsf8', s)
print "login code:", errCode
print "json:", strJson

if int(errCode) != 0:
    print "login fail"
    exit(0)

reto = json.loads(strJson)
print reto

sid = reto[u'sid']

#(errCode, strjson)  = conn_test_com.TcpSetUserInfo(100005, "Hello imsdk", sid, s )
#print "hello code:", errCode
#print "json:", strjson
Exemple #4
0
#-*- coding: utf8 -*-

import socket
import conn_test_com
import json

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

(errCode,
 strJson) = conn_test_com.TcpLogin(s,
                                   platform='a',
                                   phonenum=conn_test_com.TEST_PHONE_NUM,
                                   passwd=conn_test_com.TEST_PWD)
print "login code:", errCode
print "json:", strJson

if int(errCode) != 0:
    print "login fail"
    exit(0)

reto = json.loads(strJson)
print reto

uid = reto[u'uid']
sid = reto[u'sid']

req_json = '{"teamid":100028001, "uid":100028}'
(errCode, strJson) = conn_test_com.TcpSendReq2(s, 50023, req_json, uid, sid)
print "set team info:", errCode
print "json:", strJson
Exemple #5
0
import socket
import conn_test_com
import time
import json
#C->S:
#    sContent = dwUin+dwType+wLen+K(dwUin+strmd5(passwd)+ dwStatus + strReserved)
#S->C:
#    sContent = cResult + stOther

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

uid = 16780303007937
(errCode,
 strJson) = conn_test_com.TcpLogin(uid, 'test',
                                   '098f6bcd4621d373cade4e832627b4f6',
                                   '00b6413a92d4c1c84ad99e0a', s)
print "login code:", errCode
print "json:", strJson

reto = json.loads(strJson)
print reto

sid = reto[u'sid']

for i in range(0, 1):
    time.sleep(1)
    msg = "msg%05d" % i
    req_json = '{}'
    #req_json = '{"msgtype":0, "touid":16777266331841 ,"msgcontent": "%s"}' % (msg)
    conn_test_com.OnlyTcpSendReq2(11001, uid, req_json, sid, s)
Exemple #6
0
import StringIO
import socket
import conn_test_com
import time
import json
#C->S:
#    sContent = dwUin+dwType+wLen+K(dwUin+strmd5(passwd)+ dwStatus + strReserved)
#S->C:
#    sContent = cResult + stOther

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

(errCode,
 strJson) = conn_test_com.TcpLogin(16777266331841, 'nnhh',
                                   '453e41d218e071ccfb2d1c99ce23906a',
                                   '16777266331841', s)
print "login code:", errCode
print "json:", strJson

reto = json.loads(strJson)
print reto

sid = reto[u'sid']

(errCode, strJson) = conn_test_com.TcpUserLocation(16777266331841,
                                                   116.207629,
                                                   41.058359,
                                                   sid,
                                                   s,
                                                   1,
Exemple #7
0
#    sContent = dwUin+dwType+wLen+K(dwUin+strmd5(passwd)+ dwStatus + strReserved)
#S->C:
#    sContent = cResult + stOther

# for ip in ["122.13.81.199"]:#"14.29.84.61"]:
print conn_test_com.CONN_IP, "==========="

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

print(conn_test_com.CONN_IP, conn_test_com.CONN_PORT)

# (errCode, strJson) = conn_test_com.TcpLogin(s, platform='a', phonenum=conn_test_com.TEST_PHONE_NUM, passwd=conn_test_com.TEST_PWD)

(errCode, strJson) = conn_test_com.TcpLogin(s,
                                            platform='a',
                                            phonenum="+8613812341111",
                                            passwd=conn_test_com.TEST_PWD)
# (errCode, strJson) = conn_test_com.TcpLogin(s, platform='a', phonenum="+8618816822806", passwd=conn_test_com.TEST_PWD)

print "login code:", errCode
print "json:", strJson

if errCode != 0:
    sys.exist(0)

reto = json.loads(strJson)
print reto

sid = reto[u'sid']
uid = reto[u'uid']