typedef struct {
char s[20];
int i;
float f;
} S;
S *s=(S*)malloc(sizeof(S));
Sendto(sockfd, s, sizeof(S), 0, pservaddr, servlen);
Recvfrom(sockfd, s, sizeof(S), 0, pcliaddr, &len);
printf("receive:%lf,%d,%s\n",s->f,s->i,s->s);
typedef struct {
char s[20];
int i;
float f;
} S;
S *s=(S*)malloc(sizeof(S));
Sendto(sockfd, s, sizeof(S), 0, pservaddr, servlen);
Recvfrom(sockfd, s, sizeof(S), 0, pcliaddr, &len);
printf("receive:%lf,%d,%s\n",s->f,s->i,s->s);
转载于:https://www.cnblogs.com/yangyh/archive/2010/06/23/1763996.html