Beispiel #1
0
bool BaseClient::linkConnector(BaseConnector *c)
{
    bool ok = true;
    ok &= (bool)connect(c, SIGNAL(connecting()),                this, SLOT(UIConnectingState()));
    ok &= (bool)connect(c, SIGNAL(connected()),                 this, SLOT(UIConnectedState()));
    ok &= (bool)connect(c, SIGNAL(disconnecting()),             this, SLOT(UIDisconnectingState()));
    ok &= (bool)connect(c, SIGNAL(disconnected()),              this, SLOT(UIDisconnectedState()));
    ok &= (bool)connect(c, SIGNAL(outMessage(QString)),         this, SLOT(outMessage(QString)));
    ok &= (bool)connect(c, SIGNAL(newFrame(uint)),              this, SLOT(newFrame(uint)));
    ok &= (bool)connect(c, SIGNAL(newFrame(uint)),              this, SLOT(addCount()));
    ok &= (bool)connect(c, SIGNAL(updateSubject(SubjectData*)), this, SLOT(update(SubjectData*)));
    return ok;
}
void LSSNetworkHandler::writeBlock(int pSocket, std::string pParam){
	try {
		int sessionID = stoi(Tokenizer::getCommandSpace(pParam, 1));
		short diskID = stoi(Tokenizer::getCommandSpace(pParam, 2));
		std::string data = pParam.substr(pParam.find(' ')+1, pParam.length() - pParam.find(' '));
		if (data == ""){
			outMessage("?Error: El comando 'writeBlock' espera dos atributos\n", pSocket);
		} else {
			outMessage(LssOperations::writeBlock(diskID, data, sessionID), pSocket);
		}
	} catch (std::exception e){
		outMessage("?Error: El primer paremetro debe ser un número\n", pSocket);
	}
}
void ServerNetworkHandler::adduser(std::string pParameters, int pSocket){
	std::string user = Tokenizer::getCommandSpace(pParameters, 1);
	std::string secKey = Tokenizer::getCommandSpace(pParameters, 2);
	std::string disk = Tokenizer::getCommandSpace(pParameters, 3);

	if (disk == ""){
		outMessage("*Error de implementación: El comando interno 'adduser' espera tres parametros\n", pSocket);
	} else {
		_sessionID = ServerOperations::adduser(user, secKey, disk);
		if (_sessionID == -1){
			outMessage("Error de registro, el nombre de usuario ya existe o disco incorrecto\n", pSocket);
		}
	}
}
Beispiel #4
0
void MyServer::listen(int port)
{
    server = new QTcpServer(this);
    connect(server, SIGNAL(newConnection()), this, SLOT(newConnection()));

    if(!server->listen(QHostAddress::Any, port))
    {
        emit outMessage("Could not start server.");
    }
    else
    {
        emit outMessage(QString("Server Started.  Listening on port: %1").arg(port));
    }
}
void LSSNetworkHandler::readBytes(int pSocket, std::string pParam){
	try {
		int sessionID = stoi(Tokenizer::getCommandSpace(pParam, 1));
		short diskID = stoi(Tokenizer::getCommandSpace(pParam, 2));
		int block = stoi(Tokenizer::getCommandSpace(pParam, 3));
		int offset = stoi(Tokenizer::getCommandSpace(pParam, 4));
		int size = stoi(Tokenizer::getCommandSpace(pParam, 5));

		outMessage(LssOperations::readBytes(diskID, block, offset, size, sessionID), pSocket);

	} catch (std::exception e){
		outMessage("?Error: Error de tipo, algunos parametros debe ser números\n", pSocket);
	}
}
void ServerNetworkHandler::connect(std::string pParameters, int pSocket){
	std::string user = Tokenizer::getCommandSpace(pParameters, 1);
	std::string secKey = Tokenizer::getCommandSpace(pParameters, 2);
	std::string disk = Tokenizer::getCommandSpace(pParameters, 3);

	if (disk == ""){
		outMessage("*Error de implementación: El comando interno 'connect' espera tres parametros\n", pSocket);
	} else {
		_sessionID = ServerOperations::connect(user, secKey, disk);
		if (_sessionID == -1){
			outMessage("No se ha podido iniciar sesión, nombre de usuario, contraseña o disco incorrecto\n", pSocket);
		} 
	}

}
void LSSNetworkHandler::format(int pSocket, std::string pParam){
	try {

		int sessionID = stoi(Tokenizer::getCommandSpace(pParam, 1));
		short diskID = stoi(Tokenizer::getCommandSpace(pParam, 2));
		short blockSize = stoi(Tokenizer::getCommandSpace(pParam, 3));
		if (pParam == ""){
			outMessage("?Error: El comando 'format' espera tres atributos\n", pSocket);
		} else {
			outMessage(LssOperations::format(diskID, sessionID, blockSize), pSocket);
		}
	} catch (std::exception e){
		outMessage("?Error: El primer y segundo paremetro debe ser un número\n", pSocket);
	}
}
Beispiel #8
0
/* perform the operations for a frame:
 *   - check to see if the connections are still alive (checkAlive)
 *      - this will emit connectionsChanged if there is a any change in the connection status
 *   - grab a text stream of the current model data ( stream << *subjectList )
 *   - put the text stream on the wire s->write(...)
*/
void MyServer::process()
{
    stopProfile("Other");

    working = true;

    startProfile("checkAlive");
    int alive = checkAlive();
    stopProfile("checkAlive");

    if(alive > 0)
    {
        startProfile("Serve");

        count++;
        QString buffer;
        QTextStream stream(&buffer);
        // The following operation is threadsafe.
        startProfile("Fetch");
        subjectList->read(stream, true);
        stopProfile("Fetch");

        startProfile("Wait");
        listMutex.lock();
        stopProfile("Wait");

        // for each connection
        for(QList<ServerConnection *>::iterator i =  connections.begin(); i != connections.end(); i++)
        {
            QTcpSocket *s = (*i)->socket;
            if(s->state() != QAbstractSocket::ConnectedState) continue;

            QString d = QString("%1\nEND\r\n").arg(buffer);

            startProfile("Write");
            int written = s->write(d.toUtf8());
            stopProfile("Write");

            if(written == -1)
            {
                emit outMessage(QString(" Error writing to %1").arg(s->peerAddress().toString()));
            }
            else
            {
                s->flush();
            }
        }

        listMutex.unlock();

        stopProfile("Serve");
    }

    working = false;


    startProfile("Other");


}
void LSSNetworkHandler::isAlive(int pSocket, std::string pParam){
	try {

		int diskID = stoi(Tokenizer::getCommandSpace(pParam, 1));
		if (pParam == ""){
			outMessage("?Error: El comando 'isAlive' espera un atributo\n", pSocket);
		} else {
			std::string out = LssOperations::isAlive(diskID);
			std::cout<<"out: "<<out<<std::endl;
			outMessage(out, pSocket);
		}

	} catch (std::exception e){
		outMessage("?Error: El primer y segundo paremetro debe ser un número\n", pSocket);
	}
}
Beispiel #10
0
void ServerNetworkHandler::addReg(std::string pParameters, int pSocket){
	if (pParameters == ""){
		outMessage("?Error: El comando 'addReg' espera un parametro\n", pSocket);
	} else {
		std::string data = Tokenizer::getCommandSpace(pParameters, 1);
		outMessageValidate(ServerOperations::write(_sessionID, data, SEEK_POS), pSocket);
	}
}
Beispiel #11
0
void ServerNetworkHandler::delReg(std::string pParameters, int pSocket){
	try {
		int regNum = stoi( Tokenizer::getCommandSpace(pParameters, 1) );
		outMessageValidate(ServerOperations::delReg(_sessionID, regNum), pSocket);
	} catch (std::exception e){
		outMessage("?Error: Se esperaba un número\n", pSocket);
	}
}
Beispiel #12
0
void ServerNetworkHandler::openfile(std::string pParameters, int pSocket){
	if (pParameters == ""){
		outMessage("?Error: El comando 'openfile' espera un parametro\n", pSocket);
	} else {
		std::string path = Tokenizer::getCommandSpace(pParameters, 1);
		outMessageValidate(ServerOperations::openfile(_sessionID, path), pSocket);
	}
}
Beispiel #13
0
void Channel::sendToChannel(ConnectionPtr src, string& message) {
    MessagePtr outMessage(MessageBuffer::fromString(message));
    for (chconlist_t::iterator i = participants.begin(); i != participants.end(); ++i) {
        ConnectionPtr p = *i;
        if (p != src)
            p->send(outMessage);
    }
}
Beispiel #14
0
void LSSNetworkHandler::writeBytes(int pSocket, std::string pParam){
	try {
		int sessionID = stoi(Tokenizer::getCommandSpace(pParam, 1));
		short diskID = stoi(Tokenizer::getCommandSpace(pParam, 2));
		int block = stoi(Tokenizer::getCommandSpace(pParam, 3));
		int offset = stoi(Tokenizer::getCommandSpace(pParam, 4));
		int size = stoi(Tokenizer::getCommandSpace(pParam, 5));
		std::string data = Tokenizer::getCommandSpace(pParam, 6);
		if (data == ""){
			outMessage("?Error: El comando 'writeBytes' espera cuatro atributos\n", pSocket);
		} else {
			outMessage(LssOperations::writeBytes(diskID, block, offset, size, data, sessionID), pSocket);
		}
	} catch (std::exception e){
		outMessage("?Error: Error de tipo, algunos parametros debe ser números\n", pSocket);
	}
}
Beispiel #15
0
void ServerNetworkHandler::consoleUI(int pSocket){
	if (_consoleMode){
		std::string userInfo = ServerOperations::getInfo(_sessionID); //OBTENER PATH
		std::string currentPath = Tokenizer::getCommandSpace(userInfo, 1);
		std::string user = Tokenizer::getCommandSpace(userInfo, 2);
		std::string message = getClientIP() + std::string("@") + user + std::string(":~") + currentPath + std::string(">> ");
		outMessage(message, pSocket);
	}
}
Beispiel #16
0
void ServerNetworkHandler::consoleMode(std::string pParameters, int pSocket){
	std::string param = Tokenizer::getCommandSpace(pParameters, 1);
	if (param == "false"){
		_consoleMode = false;
	} else if (param == "true"){
		_consoleMode = true;
	} else {
		outMessage("?Error: El comando 'consoleMode' espera un boolean true/false\n", pSocket);
	}
}
Beispiel #17
0
void SpellManager::SendGlyphs(MsgEntry* notused, Client* client)
{
    psCharacter* character = client->GetCharacterData();
    csArray <glyphSlotInfo> slots;
    size_t slotNum;
    int wayNum = 0;

    character->Inventory().CreateGlyphList(slots);

    psRequestGlyphsMessage outMessage(client->GetClientNum());
    for(slotNum=0; slotNum < slots.GetSize(); slotNum++)
    {
        csString way;
        PSITEMSTATS_SLOTLIST validSlots;
        int statID;

        validSlots = slots[slotNum].glyphType->GetValidSlots();
        statID = slots[slotNum].glyphType->GetUID();

        if(validSlots & PSITEMSTATS_SLOT_CRYSTAL)
        {
            wayNum = 0;
        }
        else if(validSlots & PSITEMSTATS_SLOT_BLUE)
        {
            wayNum = 1;
        }
        else if(validSlots & PSITEMSTATS_SLOT_AZURE)
        {
            wayNum = 2;
        }
        else if(validSlots & PSITEMSTATS_SLOT_BROWN)
        {
            wayNum = 3;
        }
        else if(validSlots & PSITEMSTATS_SLOT_RED)
        {
            wayNum = 4;
        }
        else if(validSlots & PSITEMSTATS_SLOT_DARK)
        {
            wayNum = 5;
        }

        outMessage.AddGlyph(slots[slotNum].glyphType->GetName(),
                            slots[slotNum].glyphType->GetImageName(),
                            slots[slotNum].purifyStatus,
                            wayNum,
                            statID);

    }

    outMessage.Construct();
    outMessage.SendMessage();
}
Beispiel #18
0
void ServerNetworkHandler::touch(std::string pParameters, int pSocket){
	std::string path = Tokenizer::getCommandSpace(pParameters, 1);
	std::string format = Tokenizer::getCommandSpace(pParameters, 3);

	if (format == ""){
		outMessage("?Error: El comando 'touch' espera tres parametros\n", pSocket);
	} else {
		outMessageValidate(ServerOperations::touch(_sessionID, path, format), pSocket);
	}

}
Beispiel #19
0
static bool verifyRSASignature(const unsigned char *originalMessage,
                                  unsigned int messageLength,
                                  const unsigned char *signature,
                                  unsigned int sigLength)
{
    if(nullptr == originalMessage) {
        return errorMessage(_("Message is empty"));
    }

    if(nullptr == signature) {
        return errorMessage(_("Signature is empty"));
    }

    const char *settingsPath = CPLGetConfigOption("NGS_SETTINGS_PATH", nullptr);
    std::string keyFilePath = File::formFileName(settingsPath, KEY_FILE, "");
    FILE *file = VSIFOpen( keyFilePath.c_str(), "r" );
    if( file == nullptr ) {
        return errorMessage(_("Failed open file %s"), keyFilePath.c_str());
    }

    EVP_PKEY *evp_pubkey = PEM_read_PUBKEY(file, nullptr, nullptr, nullptr);
    VSIFClose( file );
    if (!evp_pubkey) {
        return errorMessage(_("Failed PEM_read_PUBKEY"));
    }

    EVP_MD_CTX *ctx = EVP_MD_CTX_create();
    if (!ctx) {
        EVP_PKEY_free(evp_pubkey);
        return errorMessage(_("Failed PEM_read_PUBKEY"));
    }

    if(!EVP_VerifyInit(ctx, EVP_sha256())) {
        EVP_MD_CTX_destroy(ctx);
        EVP_PKEY_free(evp_pubkey);
        return errorMessage(_("Failed EVP_VerifyInit"));
    }

    if(!EVP_VerifyUpdate(ctx, originalMessage, messageLength)) {
        EVP_MD_CTX_destroy(ctx);
        EVP_PKEY_free(evp_pubkey);
        return errorMessage(_("Failed EVP_VerifyUpdate"));
    }
    int result = EVP_VerifyFinal(ctx, signature, sigLength, evp_pubkey);

    EVP_MD_CTX_destroy(ctx);
    EVP_PKEY_free(evp_pubkey);

    outMessage(result == 1 ? COD_SUCCESS : COD_UNEXPECTED_ERROR,
               "Signature is %s", result == 1 ? "valid" : "invalid");

    return result == 1;
}
Beispiel #20
0
bool ConnectionInstance::sendRaw(string& message) {
    if (closed)
        return false;

    MessageBuffer* buffer = new MessageBuffer();
    MessagePtr outMessage(buffer);
    buffer->Set(message.data(), message.length());

    writeQueue.push_back(outMessage);
    ev_io_start(loop, writeEvent);
    return true;
}
Beispiel #21
0
void ServerNetworkHandler::write(std::string pParameters, int pSocket){
	if (pParameters == ""){
		outMessage("?Error: El comando 'write' espera al menos un parametro\n", pSocket);
	} else {
		std::string data = Tokenizer::getCommandSpace(pParameters, 1);

		if (Tokenizer::getCommandSpace(pParameters, 2) == ""){

			outMessageValidate(ServerOperations::write(_sessionID, data, SEEK_POS), pSocket);

		} else {

			try {

				int regNum = stoi( Tokenizer::getCommandSpace(pParameters, 2) );
				outMessageValidate(ServerOperations::write(_sessionID, data, regNum), pSocket);

			} catch (std::exception e){
				outMessage("?Error: El segundo parametro de write debe ser un número\n", pSocket);
			}
		}
	}
}
Beispiel #22
0
void ConnectionInstance::sendDebugReply(string message) {
    string outstr("ZZZ ");
    json_t* topnode = json_object();
    json_t* messagenode = json_string(message.c_str());
    if (!messagenode)
        messagenode = json_string_nocheck("Failed to parse the debug reply as a valid UTF-8 string.");
    json_object_set_new_nocheck(topnode, "message", messagenode);
    const char* replystr = json_dumps(topnode, JSON_COMPACT);
    outstr += replystr;
    free((void*) replystr);
    json_decref(topnode);
    MessagePtr outMessage(MessageBuffer::FromString(outstr));
    send(outMessage);
}
Beispiel #23
0
void ConnectionInstance::sendError(int error, string message) {
    string outstr("ERR ");
    json_t* topnode = json_object();
    json_object_set_new_nocheck(topnode, "number",
            json_integer(error)
            );
    json_t* messagenode = json_string(message.c_str());
    if (!messagenode)
        messagenode = json_string_nocheck("There was an error encoding this error message. Please report this to Kira.");
    json_object_set_new_nocheck(topnode, "message", messagenode);
    const char* errstr = json_dumps(topnode, JSON_COMPACT);
    outstr += errstr;
    MessagePtr outMessage(MessageBuffer::FromString(outstr));
    send(outMessage);
    free((void*) errstr);
    json_decref(topnode);
    DLOG(INFO) << "Sending custom error to connection: " << outstr;
}
void L1FramedTcpConnection::SendMessage(const std::vector<uint8_t>& message)
{
	// build the frame header
	struct
	{
		uint32_t signature;
		uint32_t length;
	} lengthHeader;

	lengthHeader.signature = 0xDEADC0DE;
	lengthHeader.length = message.size() - 8;

	// build the full message by copying
	std::vector<uint8_t> outMessage(sizeof(lengthHeader) + message.size());
	memcpy(&outMessage[0], &lengthHeader, sizeof(lengthHeader));
	memcpy(&outMessage[sizeof(lengthHeader)], &message[0], message.size());

	// and send it across the socket
	m_socket->Write(outMessage);
}
Beispiel #25
0
void LSSNetworkHandler::inMessage(std::string pMessage, int pSocket){
	std::string command = Tokenizer::getCommandSpace(pMessage, 1);
	std::string param = Tokenizer::getParameters(pMessage);

	if (command == "connect"){
		connect(pSocket, param);

	} else if (command == "startClient"){
		outMessage( std::to_string(LssOperations::newSession()) , pSocket);

	} else if (command == "format"){
		format(pSocket, param);

	} else if (command == "isAlive"){
		isAlive(pSocket, param);

	}else if (command == "readBlock"){
		readBlock(pSocket, param);

	} else if (command == "writeBlock"){
		writeBlock(pSocket, param);

	} else if (command == "getSize"){
		getSize(pSocket, param);
	
	} else if (command == "disconnect"){
		disconnectClient();

	}else if (command == "writeBytes"){
		writeBytes(pSocket, param);

	} else if (command == "readBytes"){
		readBytes(pSocket, param);

	} else {
		defaultCase(pSocket, command);

	}
}
Beispiel #26
0
// Check to see if all connections are alive, if not remove them from the list
// returns number of active connections.
int MyServer::checkAlive()
{
    listMutex.lock();

    bool done = false;
    bool modified = false;
	int  ret = 0;

    while(!done)
    {
        done = true;

        for(QList<ServerConnection*>::iterator i = connections.begin(); i != connections.end(); i++)
        {
            QTcpSocket *s = (*i)->socket;
            if(s->state() == QAbstractSocket::UnconnectedState)
            {
                emit outMessage(QString("Disconnected: %1").arg((*i)->str()));
                done = false;
                modified = true;
                delete *i;
                connections.erase(i);
                break;
            }

			if(s->state() == QAbstractSocket::ConnectedState)
				ret++;
        }

    }
    listMutex.unlock();

    if(modified) 
		emit connectionsChanged();

	return ret;
}
Beispiel #27
0
// There is a new connection, server sends newConnection signal to me.
void MyServer::newConnection()
{
    bool change = false;
    while(1)
    {
        QTcpSocket *socket = server->nextPendingConnection();
        if(socket == NULL) break;

        change = true;

        ServerConnection *con = new ServerConnection(socket, this);

        listMutex.lock();
        connections.append(con);
        listMutex.unlock();

        emit outMessage(QString("Connection from: ") + con->str());
    }

    if(change)
    {
        emit connectionsChanged();
    }
}
Beispiel #28
0
void Channel::sendToAll(string& message) {
    MessagePtr outMessage(MessageBuffer::fromString(message));
    for (chconlist_t::iterator i = participants.begin(); i != participants.end(); ++i) {
        (*i)->send(outMessage);
    }
}
Beispiel #29
0
FReturnCode NativeCommand::SearchCommand(intrusive_ptr< ConnectionInstance >& con, string& payload) {
    //DLOG(INFO) << "Starting search with payload " << payload;
    static string FKSstring("FKS");
    static double timeout = 5.0;
    double time = Server::getEventTime();
    if (con->timers[FKSstring] > (time - timeout))
        return FERR_THROTTLE_SEARCH;
    else
        con->timers[FKSstring] = time;

    typedef list<ConnectionPtr> clst_t;
    clst_t tosearch;
    const conptrmap_t cons = ServerState::getConnections();
    for (conptrmap_t::const_iterator i = cons.begin(); i != cons.end(); ++i) {
        if ((i->second != con) && (i->second->kinkList.size() != 0) && (i->second->status == "online" || i->second->status == "looking"))
            tosearch.push_back(i->second);
    }

    json_t* rootnode = json_loads(payload.c_str(), 0, 0);
    if (!rootnode)
        return FERR_BAD_SYNTAX;
    json_t* kinksnode = json_object_get(rootnode, "kinks");
    if (!json_is_array(kinksnode))
        return FERR_BAD_SYNTAX;

    if (json_array_size(kinksnode) > 5)
        return FERR_TOO_MANY_SEARCH_TERMS;

    json_t* gendersnode = json_object_get(rootnode, "genders");
    if (json_is_array(gendersnode))
        SearchFilterList(gendersnode, tosearch, "Gender");

    json_t* orientationsnode = json_object_get(rootnode, "orientations");
    if (json_is_array(orientationsnode))
        SearchFilterList(orientationsnode, tosearch, "Orientation");

    json_t* languagesnode = json_object_get(rootnode, "languages");
    if (json_is_array(languagesnode))
        SearchFilterList(languagesnode, tosearch, "Language preference");

    json_t* furryprefsnode = json_object_get(rootnode, "furryprefs");
    if (json_is_array(furryprefsnode))
        SearchFilterList(furryprefsnode, tosearch, "Furry preference");

    json_t* rolesnode = json_object_get(rootnode, "roles");
    if (json_is_array(rolesnode))
        SearchFilterList(rolesnode, tosearch, "Dom/Sub Role");

    json_t* positionsnode = json_object_get(rootnode, "positions");
    if (json_is_array(positionsnode))
        SearchFilterList(positionsnode, tosearch, "Position");

    if (json_array_size(kinksnode) > 0)
        SearchFilterListF(kinksnode, tosearch);

    int num_found = tosearch.size();
    if (num_found == 0)
        return FERR_NO_SEARCH_RESULTS;
    else if (num_found > 350)
        return FERR_TOO_MANY_SEARCH_RESULTS;

    json_t* newroot = json_object();
    json_t* chararray = json_array();
    for (clst_t::const_iterator i = tosearch.begin(); i != tosearch.end(); ++i) {
        json_array_append_new(chararray,
                json_string_nocheck((*i)->characterName.c_str())
                );
    }
    json_object_set_new_nocheck(newroot, "characters", chararray);
    json_object_set_new_nocheck(newroot, "kinks", kinksnode);
    string message("FKS ");
    const char* fksstr = json_dumps(newroot, JSON_COMPACT);
    message += fksstr;
    free((void*) fksstr);
    json_decref(newroot);
    MessagePtr outMessage(MessageBuffer::FromString(message));
    con->send(outMessage);
    json_decref(rootnode);
    //DLOG(INFO) << "Finished search.";
    return FERR_OK;
}
Beispiel #30
0
void ServerNetworkHandler::inMessage(std::string pMessage, int pSocket){
	pMessage = Tokenizer::cleanEntry(pMessage);
	std::string command = Tokenizer::getCommandSpace(pMessage, 1);
	if (_sessionID == -1 && command != "connect" && command != "adduser"){
		outMessage("?Error: No se ha inciado sesión\n", pSocket);
	} else {

		std::string param = Tokenizer::getParameters(pMessage);
		std::cout<<param<<std::endl;
		if (command == "get"){
			get(param, pSocket);

		} else if (command == "cd"){
			cd(param, pSocket);
		
		} else if (command == "rm"){
			rm(param, pSocket);

		} else if (command == "touch"){
			touch(param, pSocket);

		} else if (command == "connect"){
			connect(param, pSocket);

		} else if (command == "mkdir"){
			mkdir(param, pSocket);

		} else if (command == "adduser"){
			adduser(param, pSocket);

		} else if (command == "openfile"){
			openfile(param, pSocket);

		} else if (command == "appendReg"){
			appendReg(param, pSocket);

		} else if (command == "delReg"){

			if (param == ""){
				delActualReg(pSocket);
			} else {
				delReg(param, pSocket);
			}
		
		} else if (command == "write"){
			write(param, pSocket);
		
		} else if (command == "seek"){
			seek(param, pSocket);
		
		} else if (command == "addReg"){
			addReg(param, pSocket);
		
		} else if (command == "read"){

			if (param == ""){
				readActual(pSocket);
			} else {
				readRegister(param, pSocket);
			}

		} else if (command == "close"){
			close(pSocket);
		} else if (command == "consoleMode"){
			consoleMode(param, pSocket);
		} else {
			outMessage("?Error: No se ha encontrado la instrucción " + command + '\n', pSocket);
		}
		consoleUI(pSocket);
	}
}