static inline span<const T> apply(const data_t<T, N, V>& d) noexcept { static_assert(sizeof(T[N]) == sizeof(data_t<T, N, V>), ""); return {_addr(d, has_vect_data<T, N, V>()), N}; }
static inline span<const T> apply(const data_t<T, N, V> (&d)[M]) noexcept { static_assert(sizeof(T[N][M])== sizeof(data_t<T, N, V>[M]), ""); return {_addr(d[0], has_vect_data<T, N, V>()), N*M}; }
int ACE_TMAIN(int argc, ACE_TCHAR* argv[]){ u_short port = 60101; ACE::set_handle_limit(); ACE_SOCK_Acceptor _acc; ACE_INET_Addr _addr(port); if(_acc.open(_addr,1) == -1){ ACE_ERROR_RETURN((LM_ERROR, "%p\n", "open"), 1); }else if(_acc.get_local_addr(_addr) == -1){ ACE_ERROR_RETURN((LM_ERROR, "%p\n", "get_local_addr"), 1); } ACE_DEBUG((LM_DEBUG, "(%P|%t) listenning on %s\n", _addr.get_host_name())); ACE_INET_Addr cli_addr; ACE_SOCK_Stream _stream; do{ if(_acc.accept(_stream) == -1){ ACE_ERROR((LM_ERROR, "%p\n", "accept")); continue; }else{ // if(_stream.disable (ACE_NONBLOCK) == -1){ // ACE_ERROR_RETURN((LM_ERROR, // "%p\n", // "disable"), // 0); // }else if (_stream.get_remote_addr(cli_addr) == -1){ // ACE_ERROR_RETURN((LM_ERROR, // "%p\n", // "get_remote_addr"), // 0); // } // ACE_DEBUG((LM_INFO, // "(%P|%t) client %s connected from %d\n", // cli_addr.get_host_name(), // cli_addr.get_port_number())); ACE_DEBUG((LM_DEBUG, "(%P|%t) spawning the thread\n")); if(ACE_Thread_Manager::instance()->spawn(consume_input, reinterpret_cast<void*> (_stream.get_handle()), THR_DETACHED) == -1){ ACE_ERROR((LM_ERROR, "(%P|%t) %p\n", "spawn")); } } }while(true); }