add encryption

This commit is contained in:
2024-09-11 15:44:02 +03:00
parent 0d94699206
commit b24b5a1346
5 changed files with 25 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ protected:
send_thread.start(
[this] {
// write((PIString::fromNumber(++counter)).toUTF8());
PIByteArray ba(64_MiB);
PIByteArray ba(64_KiB);
write(ba);
},
2_Hz);
@@ -41,20 +41,21 @@ protected:
int main(int argc, char * argv[]) {
kbd.enableExitCapture();
piCout << argc;
PIClientServer::Server * s = nullptr;
PIClientServer::Client * c = nullptr;
if (argc > 1) {
// server
piCout << "Server";
s = new PIClientServer::Server();
s->setClientFactory([] { return new MyClient(); });
s->enableSymmetricEncryption("1122334455667788"_hex);
s->listenAll(12345);
} else {
// client
piCout << "Client";
c = new MyClient();
c->createNew();
c->enableSymmetricEncryption("1122334455667788"_hex);
c->connect(PINetworkAddress::resolve("127.0.0.1", 12345));
}