我已经定义了一个UDP套接字
#include<iostream>
#include<WinSock2.h>
sockaddr_in faraddr;
memset(&faraddr, 0, sizeof(sockaddr_in));
unsigned short Port = 6789;
faraddr.sin_family = AF_INET;
faraddr.sin_port = htons(Port);
faraddr.sin_addr.s_addr = inet_addr(Loopbackaddress);
SOCKET XmitSocket;
XmitSocket = socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP);
if (XmitSocket < 0)
{
printf("Socket Creation Failed\n");
}
int nBuffersize = 1024 * 1024;
uint8 nOptVal = 255;
setsockopt(XmitSocket,IPPROTO_IP,IP_TTL, (const char*)&nOptVal, 1);
// 标识符IP_TTL未定义
setsockopt(XmitSocket,SOL_SOCKET,SO_SNDBUF, (const char*)&nBuffersize, 4);
int prio = 6 << 5;//First 3 bits of TOS field
setsockopt(XmitSocket, SOL_IP, IP_TOS, &prio, sizeof(prio));
// 标识符SOL_IP和IP_TOS未定义
我收到编译错误我错过了一些HeaderFile