首页 > 代码库 > 有这样的事
有这样的事
有这样的事?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #include <event2/event.h> #include <event2/buffer.h> #include <event2/http.h> #include <Winsock2.h> #include <stdlib.h> #include <stdio.h> int init_win_socket() { WSADATA wsaData; if (WSAStartup(MAKEWORD(2,2) , &wsaData) != 0) { return -1; } return 0; } void generic_handler( struct evhttp_request *req, void *arg) { struct evbuffer *buf = evbuffer_new(); if (!buf) { puts( "failed to create response buffer \n" ); return ; } evbuffer_add_printf(buf, "Server Responsed. Requested: %s\n" , evhttp_request_get_uri(req)); evhttp_send_reply(req, HTTP_OK, "OK" , buf); evbuffer_free(buf); } int main( int argc, char * argv[]) { #ifdef WIN32 init_win_socket(); #endif short http_port = 8081; char *http_addr = "127.0.0.1" ; struct event_base * base = event_base_new(); struct evhttp * http_server = evhttp_new( base ); if (!http_server) { return -1; } int ret = evhttp_bind_socket(http_server,http_addr,http_port); if (ret!=0) { return -1; } evhttp_set_gencb(http_server, generic_handler, NULL); printf( "http server start OK! \n" ); event_base_dispatch( base ); evhttp_free(http_server); WSACleanup(); return 0; } |
的对方水电费德芙巧克力
int i = 0;
foreach(i; i<1000; i++){
system.out.println(i);
}
还有谁?
int i = 0;
foreach(i; i<1000; i++){
system.out.println(i);
}
int i = 0;
foreach(i; i<1000; i++){
system.out.println(i);
}
来自为知笔记(Wiz)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。