移动app
This commit is contained in:
42
hs-im-server/doc/privateSend.py
Normal file
42
hs-im-server/doc/privateSend.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import socket
|
||||
import uuid
|
||||
import json
|
||||
|
||||
|
||||
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
||||
s.connect(("127.0.0.1",9000))
|
||||
|
||||
imei = str(uuid.uuid4())
|
||||
|
||||
print(imei)
|
||||
|
||||
## 基础数据
|
||||
command = 9888
|
||||
version = 1
|
||||
clientType = 4
|
||||
messageType= 0x0
|
||||
appId = 10000
|
||||
name ='rowger'
|
||||
|
||||
## 数据转换为bytes
|
||||
commandByte = command.to_bytes(4, "big")
|
||||
versionByte = version.to_bytes(4,'big')
|
||||
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")
|
||||
imeiLength = len(imeiBytes)
|
||||
imeiLengthByte = imeiLength.to_bytes(4, 'big')
|
||||
|
||||
data = {"name": name, "appId": appId, "clientType": clientType, "imei": imei}
|
||||
|
||||
|
||||
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)
|
||||
print("Sending end")
|
||||
|
||||
Reference in New Issue
Block a user