移动app
This commit is contained in:
@@ -40,7 +40,7 @@ def ping(scoket):
|
||||
doPing(scoket)
|
||||
|
||||
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
||||
s.connect(("127.0.0.1",9000))
|
||||
s.connect(("127.0.0.1",29000))
|
||||
|
||||
# 创建一个线程专门接收服务端数据并且打印
|
||||
t1 = threading.Thread(target=ping,args=(s,))
|
||||
|
||||
@@ -11,16 +11,16 @@ import uuid
|
||||
imei = str(uuid.uuid1())
|
||||
|
||||
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
||||
s.connect(("127.0.0.1",9000))
|
||||
s.connect(("127.0.0.1",29002))
|
||||
|
||||
|
||||
## 基础数据
|
||||
command = 9888
|
||||
command = 9000
|
||||
version = 1
|
||||
clientType = 4
|
||||
messageType = 0x0
|
||||
appId = 10000
|
||||
name = 'lld'
|
||||
name = 'lld1123'
|
||||
|
||||
## 数据转换为bytes
|
||||
commandByte = command.to_bytes(4,'big')
|
||||
@@ -29,17 +29,19 @@ messageTypeByte = messageType.to_bytes(4,'big')
|
||||
clientTypeByte = clientType.to_bytes(4,'big')
|
||||
appIdByte = appId.to_bytes(4,'big')
|
||||
clientTypeByte = clientType.to_bytes(4,'big')
|
||||
imeiBytes = bytes(imei,"utf-8");
|
||||
imeiBytes = bytes(imei,"utf-8")
|
||||
imeiLength = len(imeiBytes)
|
||||
print(imeiLength)
|
||||
imeiLengthByte = imeiLength.to_bytes(4,'big')
|
||||
data = {"name": name, "appId": appId, "clientType": clientType, "imei": imei}
|
||||
data = {"name": name, "appId": appId, "clientType": clientType, "imei": imei,"userId":name}
|
||||
jsonData = json.dumps(data)
|
||||
body = bytes(jsonData, 'utf-8')
|
||||
body_len = len(body)
|
||||
bodyLenBytes = body_len.to_bytes(4,'big')
|
||||
|
||||
# s.sendall(commandByte + versionByte + clientTypeByte + messageTypeByte + appIdByte + imeiLengthByte + bodyLenBytes + imeiBytes + body)
|
||||
for x in range(100):
|
||||
for x in range(10):
|
||||
print(imeiLengthByte)
|
||||
s.sendall(commandByte + versionByte + clientTypeByte + messageTypeByte + appIdByte + imeiLengthByte + bodyLenBytes + imeiBytes + body)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user