[go: up one dir, main page]

Menu

[r56]: / gmp / gc.cpp  Maximize  Restore  History

Download this file

44 lines (28 with data), 677 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <gmp.h>
#include <unistd.h>
#include <iostream>
using namespace std;
int main()
{
cb::CGMP gmp;
gmp.init(7000);
cout << "TEST " << gmp.rtt("127.0.0.1", 6000) << endl;
// char ip[64];
// int port;
// char* data = "hello world! hello, hello!";
// int len = 1024;
char* data = new char[2000];
int32_t id;
char res[1024];
int reslen;
while (true)
{
id = 0;
gmp.sendto("127.0.0.1", 6000, id, data, 20);
gmp.recv(id, res, reslen);
cout << "response: " << id << " " << res << " " << reslen << " " << gmp.rtt("127.0.0.1", 6000) << endl;
sleep(1);
cout << endl << endl;
}
return 1;
}