From 4c2234fe202898019151b2ab75a0bf20d7380ae5 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 22 Jul 2016 14:30:06 +0800 Subject: [PATCH] get correct control code --- cocos/network/SocketIO.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cocos/network/SocketIO.cpp b/cocos/network/SocketIO.cpp index 04c655d9fa..b579b57cab 100644 --- a/cocos/network/SocketIO.cpp +++ b/cocos/network/SocketIO.cpp @@ -877,9 +877,8 @@ void SIOClientImpl::onMessage(WebSocket* ws, const WebSocket::Data& data) break; case 4: { - const char second = payload.at(0); - int control2 = atoi(&second); - CCLOGINFO("Message code: [%i]", control); + int control2 = payload.at(0) - '0'; + CCLOGINFO("Message code: [%i]", control2); SocketIOPacket *packetOut = SocketIOPacket::createPacketWithType("event", _version); std::string endpoint = "";