3 #include <senf/Socket/Protocols/INet.hh>
4 #include <senf/Scheduler/Scheduler.hh>
5 #include <senf/Utils/membind.hh>
9 senf::UDPv4ClientSocketHandle serverSock;
12 Server(senf::INet4Address const & host, unsigned int port)
13 : serverSock(senf::INet4SocketAddress(host, port)) {}
17 senf::Scheduler::instance().add(serverSock, senf::membind(&Server::readFromClient, this), senf::Scheduler::EV_READ);
18 senf::Scheduler::instance().process();
22 void readFromClient(senf::Scheduler::EventId event)
24 std::string data (serverSock.read());
25 std::cout << "> " << data<<std::endl ;
29 int main(int argc, char const * argv[])
33 Server testSock(senf::INet4Address::Loopback, 4243);
37 catch (std::exception const & ex) {
38 std::cerr << senf::prettyName(typeid(ex)) << ": " << ex.what() << "\n";