#include "interface/module.h" #include "interface/server.h" #include "interface/event.h" #include "interface/tcpsocket.h" //#include "network/include/api.h" #include using interface::Event; namespace network { struct Module: public interface::Module { interface::Server *m_server; sp_ m_socket; Module(interface::Server *server): m_server(server), m_socket(interface::createTCPSocket()) { std::cout<<"network construct"<sub_event(this, interface::Event::t("core:start")); } ~Module() { std::cout<<"network destruct"<bind_fd(address, port) || !m_socket->listen_fd()){ std::cerr<<"Failed to bind to "<add_socket(m_socket); } }; extern "C" { EXPORT void* createModule_network(interface::Server *server){ return (void*)(new Module(server)); } } }