mirror of
https://github.com/modelec/connectors.git
synced 2026-01-19 01:08:25 +01:00
33 lines
544 B
C++
33 lines
544 B
C++
#include "MyTCPClient.h"
|
|
|
|
#include <iostream>
|
|
#include <thread>
|
|
#include <atomic>
|
|
#include <mutex>
|
|
#include <string>
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int port = 8080;
|
|
if (argc > 1) {
|
|
port = atoi(argv[1]);
|
|
}
|
|
|
|
MyTCPClient client("127.0.0.1", port);
|
|
|
|
client.start();
|
|
|
|
while (true) {
|
|
std::string message;
|
|
std::getline(std::cin, message);
|
|
|
|
if (message == "quit") {
|
|
client.stop();
|
|
break;
|
|
}
|
|
|
|
client.sendMessage(message.c_str());
|
|
}
|
|
|
|
return 0;
|
|
} |