当前位置: 技术问答>linux和unix
求助!ntp协议客户端实现时,select超时
来源: 互联网 发布时间:2016-07-26
本文导语: #define NTPSVR1 "210.72.145.44"//"132.163.4.102" //USA #define NTPSVR2 "132.163.135.132" //USA #define NTPSVR3 "192.53.103.103" //Germany #define NTPPORT 123 typedef struct NTPPACKET { uint8 li_vn_mode; uint8 st...
#define NTPSVR1 "210.72.145.44"//"132.163.4.102" //USA
#define NTPSVR2 "132.163.135.132" //USA
#define NTPSVR3 "192.53.103.103" //Germany
#define NTPPORT 123
typedef struct NTPPACKET
{
uint8 li_vn_mode;
uint8 stratum;
uint8 poll;
uint8 precision;
ulong32 root_delay;
ulong32 root_dispersion;
int8 ref_id[4];
ulong32 reftimestamphigh;
ulong32 reftimestamplow;
ulong32 oritimestamphigh;
ulong32 oritimestamplow;
ulong32 recvtimestamphigh;
ulong32 recvtimestamplow;
ulong32 trantimestamphigh;
ulong32 trantimestamplow;
}NTPPacket;
NTPPacket ntppack,newpack;
void NTP_Init()
{
bzero(&ntppack,sizeof(ntppack));
ntppack.li_vn_mode=0x1b;//0|(3