This commit is contained in:
aozhiwei 2019-05-23 16:39:31 +08:00
parent 173b825763
commit 15ac657d30
2 changed files with 11 additions and 7 deletions

View File

@ -22,7 +22,11 @@ def main():
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
ws_url = args if args else 'ws://192.168.100.21:7101/websocket' ws_url = args if args else 'ws://192.168.100.21:7101/websocket'
for account in options.accounts.split(','): accounts = options.accounts.split(',')
accounts = []
for i in range(10):
accounts.append('test' + str(i))
for account in accounts:
ioloop.IOLoop.current().spawn_callback(createVirtualClient, account, ws_url) ioloop.IOLoop.current().spawn_callback(createVirtualClient, account, ws_url)
while True: while True:

View File

@ -79,14 +79,14 @@ class VirtualClient(object):
def onReceiveUserPacket(self, conn, msgid, msgbody): def onReceiveUserPacket(self, conn, msgid, msgbody):
try: try:
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')) #print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f'))
msg = getSMMsg(msgid) msg = getSMMsg(msgid)
ret = msg.ParseFromString(msgbody) ret = msg.ParseFromString(msgbody)
print(len(msgbody)) #print(len(msgbody))
print(time.time(), time.strftime('[%H:%M:%S]'), msg.DESCRIPTOR.name + '{') #print(time.time(), time.strftime('[%H:%M:%S]'), msg.DESCRIPTOR.name + '{')
print(str(msg), end='') #print(str(msg), end='')
print('}') #print('}')
print('') #print('')
except Exception as e: except Exception as e:
print('onReceiveUserPacket', e) print('onReceiveUserPacket', e)