#include #include #include #include #include #include #include #include #include #define socketerrno errno #define SOCKET_EAGAIN_EINPROGRESS EAGAIN #define SOCKET_EWOULDBLOCK EWOULDBLOCK #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 typedef int socket_t; #include "../common/iobuffer.h" #include "protocol.pb.h" int main(int, char**){ int _fd = socket(AF_INET, SOCK_DGRAM, 0); sockaddr_in sin; sin.sin_family = AF_INET; sin.sin_port = htons(23816); sin.sin_addr.s_addr = inet_addr("192.168.3.131"); MessageHead Head; Head.Command=RemoNet::CS_SyncTime; Head.Length=0; CIOBuffer buffer; Head.Serialize(buffer.Buffer); buffer.Length=sizeof(MessageHead); int32_t ret=sendto(_fd,buffer.Buffer,buffer.Length,0,(sockaddr * )&sin,sizeof(sin)); sockaddr_in from; socklen_t fromlen=sizeof(sockaddr_in); ret=recvfrom(_fd,buffer.Buffer,CIOBuffer::IO_BUFFER_SIZE,0,(sockaddr *)&from,&fromlen); if(ret>0) { MessageHead Head; Head.Deserialize(buffer.Buffer); if(ret