} // 设置定时器以实现超时功能 struct timeval timeout = {5, 0}; // 5秒超时 struct event *timeout_event = evtimer_new(base, on_timeout, bev); if (!timeout_event || evtimer_add(timeout_event, &timeout) < 0) { fprintf(stderr, "Error adding timeout event! "); buffere...
intmain(intargc,char**argv){structsockaddr_inserv_addr;structevent_base*base;structbufferevent*bev, *bev_stdout;inti, addr_len =sizeofserv_addr;structtimevaltimeout= {1,0}; base = event_base_new();if(evutil_parse_sockaddr_port("127.0.0.1:8200", (struct sockaddr *)&serv_addr, &addr_l...