Simple TCP socket library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
socket/test/server.cpp

39 lines
1.0 KiB

1 year ago
#include <iostream>
#include "../lib/tcp_socket.hpp"
using namespace std;
int main() {
try{
cout << "init server " << endl;
1 year ago
server myserver(5000, 10);
cout << "init cert " << endl;
secure crypto ("../example/cert.pem", "../example/privkey.pem");
cout << "init client " << endl;
comming myclient(&myserver, 1000, crypto.fds);
cout << "wait client " << myclient.ipv4 << endl;
1 year ago
string fromclient = myclient.obey();
cout << "tell client " << fromclient << endl;
sleep(5);
1 year ago
myclient.tell(fromclient);
// myclient.~comming();
// while (true) {
// comming myclient(&myserver, 1000);
// string fromclient = myclient.obey();
// cout << fromclient << " " << myclient.conn << endl;
// cout << "Poslano: " << myclient.tell(fromclient) << "Veličin: " << fromclient.length() << endl;
// // myclient.~comming();
// cout << "IPv4 " << myclient.ipv4 << " ipv6 " << myclient.ipv6;
// }
// sleep(80);
}
catch(const string err) {
cout << err << endl;
}
1 year ago
return 0;
}