diff --git a/test_conf/Makefile b/test_conf/Makefile new file mode 100644 index 0000000..f65eaa5 --- /dev/null +++ b/test_conf/Makefile @@ -0,0 +1,2 @@ +test_conf: test_conf.cpp + g++ $^ -o $@ -levent \ No newline at end of file diff --git a/test_conf/first_libevent.vcxproj b/test_conf/first_libevent.vcxproj new file mode 100644 index 0000000..3a4f330 --- /dev/null +++ b/test_conf/first_libevent.vcxproj @@ -0,0 +1,162 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {129BF326-BFEE-4F1C-920C-0C302BB84895} + Win32Proj + firstlibevent + 10.0.17763.0 + test_conf + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + NotUsing + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + ..\..\lib + libevent.lib;ws2_32.lib;%(AdditionalDependencies) + + + + + + + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/test_conf/first_libevent.vcxproj.user b/test_conf/first_libevent.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/test_conf/first_libevent.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/test_conf/test_conf.cpp b/test_conf/test_conf.cpp new file mode 100644 index 0000000..0258027 --- /dev/null +++ b/test_conf/test_conf.cpp @@ -0,0 +1,50 @@ + +#include +#include + +#ifndef _WIN32 +#include +#endif // !_WIN32 + +using namespace std; + +int main() +{ +#ifdef _WIN32 + //初始化socket库 + WSADATA wsa; + WSAStartup(MAKEWORD(2, 2), &wsa); +#else + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { //忽略管道信号,发送数据给已关闭的socket,会飞掉! + return 1; + } +#endif + + //初始化libevent上下文 + event_config *conf = event_config_new(); + + //显示支持的网络模式 + const char** methods = event_get_supported_methods(); + cout << "supported_methods" << endl; + for (int i = 0; methods[i] != NULL; i++) { + cout << methods[i] << endl; + } + + event_base* base = event_base_new_with_config(conf); + + + + if (!base) { + cout << "event_base_new_with_config failed!" << endl; + } + else { + cout << "event_base_new_with_config success!" << endl; + event_config_free(conf); + } + + + + return 0; +} + + diff --git a/test_conf/test_conf.sln b/test_conf/test_conf.sln new file mode 100644 index 0000000..9343ad4 --- /dev/null +++ b/test_conf/test_conf.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1525 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "first_libevent", "first_libevent.vcxproj", "{129BF326-BFEE-4F1C-920C-0C302BB84895}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Debug|x64.ActiveCfg = Debug|x64 + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Debug|x64.Build.0 = Debug|x64 + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Debug|x86.ActiveCfg = Debug|Win32 + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Debug|x86.Build.0 = Debug|Win32 + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Release|x64.ActiveCfg = Release|x64 + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Release|x64.Build.0 = Release|x64 + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Release|x86.ActiveCfg = Release|Win32 + {129BF326-BFEE-4F1C-920C-0C302BB84895}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {191D7F93-7554-493B-92E1-BB302C5A8383} + EndGlobalSection +EndGlobal