本文整理汇总了C++中NetClient::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ NetClient::getData方法的具体用法?C++ NetClient::getData怎么用?C++ NetClient::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetClient
的用法示例。
在下文中一共展示了NetClient::getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MPIClient
static void
doB()
{
cout << "[B] Initialized." << endl;
NetClient* net = new MPIClient(1);
mpz_t a;
mpz_init_set_ui(a, 0);
string header;
header = net->waitForMessage();
int valid = net->getDataAsZVector(&a, 1);
cout << "[B] Recv " << valid << " mpz_t from A with the header: '" << header << "'" << endl;
gmp_printf("[B] We got: %Zd\n", a);
mpz_set_si(a, rand() + 2342);
cout << "[B] Send " << 1 << " mpz_t to A." << endl;
gmp_printf("[B] Should expect: %Zd\n", a);
net->sendZVector("Vec from B.", &a, 1);
header = net->waitForMessage();
cout << "[B] Recv Empty from A." << endl;
cout << "[B] H: " << header << endl;
header = net->waitForMessage();
cout << "[B] Recv MSG treated as empty from A." << endl;
cout << "[B] H: " << header << endl;
char* buf;
header = net->waitForMessage();
size_t len = net->getData(&buf);
cout << "[B] Recv MSG from A." << endl;
cout << "[B] H: " << header << endl;
header.assign(buf, len);
cout << "[B] len: " << len << " D: " << header << endl;
cout << net->getGlobalStat() << endl;
delete net;
}