Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void networking::TCP_Server::acceptConnection() {
- std::string stringToSend{"This is a test string to be replied to"};
- int new_fd = accept(listeningFD, nullptr, nullptr);
- send(new_fd, stringToSend.c_str(), stringToSend.size(), 0);
- sleep(3);
- std::cout << ("End of thread");
- }
- ///LISTEN FOR CONNECTIONS ON listeningFD
- ///CREATE A LIST OF FILE DESCRIPTORS FOR POLL fds[]
- (fds[i].fd == listeningFD) {
- do {
- std::cout << ("New incoming connection - %dn", new_fd);
- std::async(std::launch::async, acceptConnection)
- } while (new_fd != -1);
- } /* End of existing connection is readable */
- } /* End of loop through pollable descriptors */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement