void MessageHandler::ConnectSocketToHost(QString host_address, quint16 port) { socket_->abort(); // In case there was already a connection socket_->connectToHost(host_address, port); connect(socket_, SIGNAL(connected()), this, SLOT(HandleConnected())); connect(socket_, SIGNAL(disconnected()), this, SLOT(HandleDisconnected())); }
void PacketHandlerCL::Handle(ServerSocketCL* socket , int command, const void* data, int length) { ::printf("Command[%d] data[%p] length[%d]\n", command, data, length); switch (command) { case COMMAND_CL_CONNECTED: HandleConnected(socket, data, length); break; case COMMAND_CL_DISCONNECTED: HandleDisconnected(socket, data, length); break; case COMMAND_CL_USERLOGIN: HandleUserLogin(socket, data, length); break; case COMMAND_CL_SELECTSERVER: HandleSelectServer(socket, data, length); break; default: break; } }