编译VC代码提示打不开server.h
来源:百度知道 编辑:UC知道 时间:2024/06/30 20:12:18
代码的头文件是
#include "client.h"
#include <time.h>
#include <ctype.h>
一楼那个不行,我试过,你给的那两个代码本身都有问题....
先给除服务端代码:
#include <stdio.h>
#include <Winsock2.h>
void main()
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return;
}
/* Confirm that the WinSock DLL supports 2.2.*/
/* Note that if the DLL supports versions greater */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
WSACleanup( );
return;
}
SOCKET sockSrv=socket(AF_INET, SOCK_DGRAM, 0);
SOCKADDR_IN addrSrv;
addr