|
|
|
@ -6,25 +6,25 @@ using namespace std; |
|
|
|
|
|
|
|
|
|
int main() { |
|
|
|
|
try{ |
|
|
|
|
cout << "init cert " << endl; |
|
|
|
|
secure crypto ("../example/cert.pem", "../example/privkey.pem"); |
|
|
|
|
cout << "init server " << endl; |
|
|
|
|
server myserver(5000, 100, crypto.fds); |
|
|
|
|
|
|
|
|
|
cout << "init client " << endl; |
|
|
|
|
|
|
|
|
|
// client myclient(&myserver, 100, crypto.fds);
|
|
|
|
|
// comming myclient(&myserver, 100);
|
|
|
|
|
myserver.accept(); |
|
|
|
|
// cout << "wait client " << myclient.ipv4 << endl;
|
|
|
|
|
cout << "wait client " << myserver.cli->ipv4 << endl; |
|
|
|
|
|
|
|
|
|
string fromclient = myserver.cli->pull(); |
|
|
|
|
// string fromclient = myclient.pull();
|
|
|
|
|
cout << "tell client " << fromclient << endl; |
|
|
|
|
// usleep(600*1000);
|
|
|
|
|
sleep(5); |
|
|
|
|
myserver.cli->push(fromclient); |
|
|
|
|
// cout << "init cert " << endl;
|
|
|
|
|
// secure crypto ("../example/cert.pem", "../example/privkey.pem");
|
|
|
|
|
// cout << "init server " << endl;
|
|
|
|
|
// server myserver(5000, 100, crypto.fds);
|
|
|
|
|
|
|
|
|
|
// cout << "init client " << endl;
|
|
|
|
|
|
|
|
|
|
// // client myclient(&myserver, 100, crypto.fds);
|
|
|
|
|
// // comming myclient(&myserver, 100);
|
|
|
|
|
// myserver.accept();
|
|
|
|
|
// // cout << "wait client " << myclient.ipv4 << endl;
|
|
|
|
|
// cout << "wait client " << myserver.cli->ipv4 << endl;
|
|
|
|
|
|
|
|
|
|
// string fromclient = myserver.cli->pull();
|
|
|
|
|
// // string fromclient = myclient.pull();
|
|
|
|
|
// cout << "tell client " << fromclient << endl;
|
|
|
|
|
// // usleep(600*1000);
|
|
|
|
|
// sleep(5);
|
|
|
|
|
// myserver.cli->push(fromclient);
|
|
|
|
|
// myclient.push(fromclient);
|
|
|
|
|
// myclient.~comming();
|
|
|
|
|
|
|
|
|
@ -38,6 +38,16 @@ int main() { |
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// sleep(80);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server myserver(5000, 100); |
|
|
|
|
myserver.asyncli(8, [](client *cli) { |
|
|
|
|
cout << "Klijent " << cli->ipv4 << endl; |
|
|
|
|
string fromclient = cli->pull(); |
|
|
|
|
cout << "S klijenta " << fromclient << endl; |
|
|
|
|
cli->push(fromclient); |
|
|
|
|
}, 200); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
catch(const string err) { |
|
|
|
|
cout << err << endl; |
|
|
|
|