当前位置: 首页>>代码示例>>C++>>正文


C++ sendToServer函数代码示例

本文整理汇总了C++中sendToServer函数的典型用法代码示例。如果您正苦于以下问题:C++ sendToServer函数的具体用法?C++ sendToServer怎么用?C++ sendToServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendToServer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sendToServer

void ClientInfo::selectItem( const QString& item )
{
    // item in listBox selected, use LIST or GET depending of the node type.
    if ( item.endsWith( "/" ) ) {
	sendToServer( List, infoPath->text() + item );
	infoPath->setText( infoPath->text() + item );
    } else 
	sendToServer( Get, infoPath->text() + item );
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:9,代码来源:client.cpp

示例2: sendToServer

void LCD::setMusicRepeat(int repeat)
{
    if (!m_lcdReady || !m_lcdShowMusic)
        return;

    sendToServer(QString("SET_MUSIC_PLAYER_PROP REPEAT %1").arg(repeat));
}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:7,代码来源:lcddevice.cpp

示例3: registration

bool registration(string name, string password){
    char wiad[49]="";

    if(name.length()>20){ cout << "Nazwa za dluga!\n"; return false; }
    if(password.length()>20){ cout << "Haslo za dlugie!\n"; return false; }

    string whole="register"+name+":"+password;
    strcat(wiad, whole.c_str());
    sendToServer(wiad);
    cout << "Wyslano\n";

    //while(1) {
        cout << "Oczekiwanie na info od serwera!\n";
        if(event.type == ENET_EVENT_TYPE_RECEIVE) {
            if(receive(event.packet->data, "GOOD")) {
                cout << "REJESTRACJA ZAKONCZONA POMYSLNIE!" << endl;
                return true;
                //break;
            }
            else if(receive(event.packet->data, "FAIL")) {
                cout << "REJESTRACJA ZAKONCZONA NEGATYWNIE!" << endl;
                return false;
                //break;
            }
        }
    //}
}
开发者ID:SeaMonster131,项目名称:strategia,代码行数:27,代码来源:account.cpp

示例4: qDebug

void TcpClientSocket::dataReceived()
{
    qDebug()<<"缓冲区现有字节"<<(bytesAvailable());
    //按照Demo改
    QDataStream in(this);
    QString Message;
    in.setVersion(QDataStream::Qt_5_5);
    quint16 size = 0;
    if(size == 0)
    {
        if(this->bytesAvailable() < sizeof(quint16))
            return;
        in >> size;
    }
    if(size == 0xFFFF) return;
    if(this->bytesAvailable() < size)
    {
        qDebug() << size << endl;
        return;
    }
    in >> Message;
    QByteArray string1 = Message.toUtf8();
    QJsonDocument ParseDocument = QJsonDocument::fromJson(string1);
    QJsonObject obj = ParseDocument.object();

    qDebug() << obj << endl;
    emit sendToServer(this->no,obj);

}
开发者ID:fengshenfeilian,项目名称:airCondition,代码行数:29,代码来源:tcpclientsocket.cpp

示例5: sendMessageHidden

void sendMessageHidden(string str,string message){
	vector<string> temp;
	string ret;
	//string message;
	//cout << "Please enter your message to " << str << " : ";
	//getline(cin >> ws,message);
	temp.push_back("MSG");
	temp.push_back(username);
	temp.push_back(str);
	temp.push_back(currentDateTime());
	temp.push_back(message);
	ret = protocolMaker(temp);	
	if (sendToServer(ret) == 0){
		string path = "bin/client/message_history/";
		path += username;
		path += "-";
		path += str;
		path += ".txt";
		vector<string> data = readExternalFileAutoCreate(path);
		data.push_back(ret);
		//moveToBottom(path);
		//writeExternalFile(path,data);
		writeExternalFile2(path,ret); //append data baru aja
	}
	else{
		cout << "Failed to send messages or the user does not exist!" << endl << endl;
	}	
}
开发者ID:ClearingPath,项目名称:Linker-Messeger,代码行数:28,代码来源:client.cpp

示例6: getNetworkString

/** Sends a vote for the number of tracks from a client to the server. Note
 *  that even this client will only store the vote when it is received back
 *  from the server.
 *  \param player_id The global player id of the voting player.
 *  \param count NUmber of tracks to play.
 */
void ClientLobbyRoomProtocol::voteRaceCount(uint8_t player_id, uint8_t count)
{
    NetworkString *request = getNetworkString(3);
    request->addUInt8(LE_VOTE_RACE_COUNT).addUInt8(player_id).addUInt8(count);
    sendToServer(request, true);
    delete request;
}   // voteRaceCount
开发者ID:Elderme,项目名称:stk-code,代码行数:13,代码来源:client_lobby_room_protocol.cpp

示例7: sqlite3_client_close

int sqlite3_client_close(sqlite3 *pDb){
  SqlMessage msg;
  msg.op = MSG_Close;
  msg.pDb = pDb;
  sendToServer(&msg);
  return msg.errCode;
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:7,代码来源:test_server.c

示例8: sqlite3_client_finalize

int sqlite3_client_finalize(sqlite3_stmt *pStmt){
  SqlMessage msg;
  msg.op = MSG_Finalize;
  msg.pStmt = pStmt;
  sendToServer(&msg);
  return msg.errCode;
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:7,代码来源:test_server.c

示例9: sendToServer

void Terminal::_prepareHeader(const QString & string)
{
	DataHeader head;
	head.SetAction(DataHeader::TERMINAL_JOB);
	head.setActionSpecs(string);
	emit sendToServer(head);
}
开发者ID:puzzleSEQ,项目名称:client,代码行数:7,代码来源:terminal.cpp

示例10: requestFromServer

size_t requestFromServer(const char * request, const size_t requestLen, const size_t hintLength, char ** outputBuffer) {
    sendToServer(request, requestLen);
    ssize_t requestLength = hintLength > MIN_LENGTH ? hintLength : MIN_LENGTH;
    size_t outputLength = 0;
    char * output = calloc(sizeof(char), requestLength);
    char * readBuffer = calloc(sizeof(char), requestLength);
    int done = 0;
    while (!done) {
        memset(readBuffer, 0, requestLength);
        ssize_t charactersRead = read(serverFd, readBuffer, requestLength);
		if (charactersRead < 0)
			break;
        size_t oldOutputLength = outputLength;
        outputLength += charactersRead;
        if (charactersRead == requestLength) {
            requestLength *= 2;
            readBuffer = realloc(readBuffer, requestLength);
        } else {
            done = 1;
        }
        output = realloc(output, outputLength);
        memcpy(output+oldOutputLength, readBuffer, charactersRead);
    }
    *outputBuffer = output;
    free(readBuffer);
    return outputLength;
}
开发者ID:Andrew-Miranti,项目名称:miranti2,代码行数:27,代码来源:distributed.c

示例11: GetMythDB

void LCD::init()
{
    // Stop the timer
    m_retryTimer->stop();

    // Get LCD settings
    m_lcdShowMusic = (GetMythDB()->GetSetting("LCDShowMusic", "1") == "1");
    m_lcdShowTime = (GetMythDB()->GetSetting("LCDShowTime", "1") == "1");
    m_lcdShowChannel = (GetMythDB()->GetSetting("LCDShowChannel", "1") == "1");
    m_lcdShowGeneric = (GetMythDB()->GetSetting("LCDShowGeneric", "1") == "1");
    m_lcdShowVolume = (GetMythDB()->GetSetting("LCDShowVolume", "1") == "1");
    m_lcdShowMenu = (GetMythDB()->GetSetting("LCDShowMenu", "1") == "1");
    m_lcdShowRecStatus = (GetMythDB()->GetSetting("LCDShowRecStatus", "1") == "1");
    m_lcdKeyString = GetMythDB()->GetSetting("LCDKeyString", "ABCDEF");

    m_connected = true;
    m_lcdReady = true;

    // send buffer if there's anything in there
    if (m_sendBuffer.length() > 0)
    {
        sendToServer(m_sendBuffer);
        m_sendBuffer = "";
    }
}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:25,代码来源:lcddevice.cpp

示例12: sqlite3_client_reset

int sqlite3_client_reset(sqlite3_stmt *pStmt){
  SqlMessage msg;
  msg.op = MSG_Reset;
  msg.pStmt = pStmt;
  sendToServer(&msg);
  return msg.errCode;
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:7,代码来源:test_server.c

示例13: getNetworkString

// ----------------------------------------------------------------------------
void GameEventsProtocol::sendStartupBoost(uint8_t kart_id)
{
    NetworkString *ns = getNetworkString();
    ns->setSynchronous(true);
    ns->addUInt8(GE_STARTUP_BOOST).addUInt8(kart_id);
    sendToServer(ns, /*reliable*/true);
    delete ns;
}   // sendStartupBoost
开发者ID:devnexen,项目名称:stk-code,代码行数:9,代码来源:game_events_protocol.cpp

示例14: sqlite3_client_open

/*
** The following 6 routines are client-side implementations of the
** core SQLite interfaces:
**
**        sqlite3_open
**        sqlite3_prepare
**        sqlite3_step
**        sqlite3_reset
**        sqlite3_finalize
**        sqlite3_close
**
** Clients should use the following client-side routines instead of 
** the core routines above.
**
**        sqlite3_client_open
**        sqlite3_client_prepare
**        sqlite3_client_step
**        sqlite3_client_reset
**        sqlite3_client_finalize
**        sqlite3_client_close
**
** Each of these routines creates a message for the desired operation,
** sends that message to the server, waits for the server to process
** then message and return a response.
*/
int sqlite3_client_open(const char *zDatabaseName, sqlite3 **ppDb){
  SqlMessage msg;
  msg.op = MSG_Open;
  msg.zIn = zDatabaseName;
  sendToServer(&msg);
  *ppDb = msg.pDb;
  return msg.errCode;
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:33,代码来源:test_server.c

示例15: login

bool login(string name, string password, CPlayer* player, CCamera* camera){
    char wiad[49]="";

    if(name.length()>20){ cout << "Name too long!\n"; return false; }
    if(password.length()>20){ cout << "Password too long!\n"; return false; }

    string whole="login"+name+":"+password;
    strcat(wiad, whole.c_str());
    player->nick = name;
    sendToServer(wiad);

    cout << "Sent!\n";

    while(1) {
        if(event.type == ENET_EVENT_TYPE_RECEIVE) {

            if(receive(event.packet->data, "GOOD")) {
                cout << "\nLogged!\n" << endl;

                string wiad = getPacket(event.packet->data);

                string var = "";
                int index = 0, what = 0;
                for(int i = 5; i < wiad.size()+2; ++i) {
                    if(wiad[i] != ' ') {
                        var.resize(var.size()+1);
                        var[index] = wiad[i];
                        ++index;
                    }
                    else {
                        index = 0;
                        ++what;
                        if(what == 1) player->hair = atoi(var.c_str());
                        if(what == 2) player->head = atoi(var.c_str());
                        if(what == 3) player->body = atoi(var.c_str());
                        if(what == 4) player->leg = atoi(var.c_str());
                        if(what == 5) player->boots = atoi(var.c_str());
                        if(what == 6) player->pos.x = atoi(var.c_str());
                        if(what == 7) player->pos.y = atoi(var.c_str());
                        var = "";
                    }
                }

                camera->setPos(player->pos.x, player->pos.y);

                return true;
            }
            else if(receive(event.packet->data, "FAIL")) {
                cout << "\nError when logging!\n" << endl;
                return false;
            }
            else {
                cout << "\nUuu smieci dostaje!\n" << endl;
                return false;
            }
        }
    }
}
开发者ID:SeaMonster131,项目名称:strategia,代码行数:58,代码来源:account.cpp


注:本文中的sendToServer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。