例如,我想知道是否有任何显着差异或好的/坏的做法
这样做:
unsigned int length_addr;
length_addr = sizeof(cli_addr);
nbytes = recvfrom(sockfd, buffer, sizeof(buffer), 0,
(struct sockaddr *)&cli_addr, &length_addr);
这样:
nbytes = recvfrom(sockfd, buffer, sizeof(buffer), 0,
(struct sockaddr *)&cli_addr, sizeof(cli_addr));