123456789101112131415161718192021222324252627282930313233 |
- #include "lfr_socket.h"
-
- int main()
- {
- std::mutex mutex;
- LFR_Socket socket([&](std::exception const &ex)
- {
- std::unique_lock<std::mutex> lock(mutex);
- std::cerr<<"socket exception:"<<ex.what()<<std::endl;
- return false;
- });
-
- socket.addListener([&](LFR_Socket::LFR_Telegram telegram)
- {
- std::unique_lock<std::mutex> lock(mutex);
- std::cout << telegram;
- }, &mutex);
-
- socket.startLoop();
-
- //send(new_socket, "Hello from the server", sizeof("Hello from the server"), 0);
- char input;
- std::cout << "fress q to quit" << std::endl;
- std::cin >> input;
- std::cout << "cinned" << std::endl;
- while (input != 'q')
- {
- std::cin >> input;
- std::cout << "cinned" << std::endl;
- }
- std::cout << "im out" << std::endl;
- return 0;
- }
|