superdog/server/main.cpp

41 lines
1.1 KiB
C++
Raw Normal View History

2021-07-02 05:53:07 +00:00
/*
* @Author: your name
* @Date: 2021-06-30 10:02:04
* @LastEditTime: 2021-07-02 11:46:43
* @LastEditors: your name
* @Description: In User Settings Edit
* @FilePath: \server\main.cpp
*/
2021-06-24 07:09:25 +00:00
#include <iostream>
2021-06-30 09:31:56 +00:00
#include "tcp_server_libevent.h"
#include "winsock2.h"
#include <stdio.h>
2021-06-24 07:09:25 +00:00
int main(){
2021-06-30 09:31:56 +00:00
WORD wdVersion = MAKEWORD(2, 2);//定义自己需要的网络库版本这里是2.2
WSADATA wdSockMsg;//这是一个结构体
int nRes = WSAStartup(wdVersion, &wdSockMsg);//打开一个套接字
2021-07-02 05:53:07 +00:00
if (0 != nRes) {
switch (nRes) {
2021-06-30 09:31:56 +00:00
case WSASYSNOTREADY:
printf("check your library");
break;
case WSAVERNOTSUPPORTED:
printf("need updated");
break;
case WSAEINPROGRESS:
printf("need reboot");
break;
case WSAEPROCLIM:
printf("sdfsdfsa");
break;
}
}
2021-07-02 05:53:07 +00:00
if (2 != HIBYTE(wdSockMsg.wVersion) || 2 != LOBYTE(wdSockMsg.wVersion)) {
printf("WSACleanup");
2021-06-30 09:31:56 +00:00
WSACleanup();
return 0;
}
std::cout<<"start server libevent\r\n";
2021-07-02 05:53:07 +00:00
// test_tcp_server();
2021-06-24 07:09:25 +00:00
}