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.
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "../lib/tcp_socket.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
secure crypto;
|
|
|
|
cout << "init cert " << endl;
|
|
|
|
|
|
|
|
client myserver("127.0.0.1", 5000, 5000, crypto.fds);
|
|
|
|
// client myserver("localhost", 5000);
|
|
|
|
cout << "init client " << endl;
|
|
|
|
|
|
|
|
|
|
|
|
string sends = "Hello world!";
|
|
|
|
cout << myserver.push(sends) << " " << sends.length() << endl;
|
|
|
|
cout << "wait client " << endl;
|
|
|
|
|
|
|
|
cout << myserver.pull();
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (const string err) {
|
|
|
|
cout << err << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|