我正在尝试通过 UDP 套接字发送结构,我收到了正确的 DRB_count 值但无法接收 KenbStar 的值。我究竟做错了什么?我正在使用同一台机器,在客户端和服务器中使用相同的端口环回 ip 127.0.01。
客户:
typedef struct tseTargetCellInformation{
UInt8 DRB_count;
UInt8 *KenbStar;
}tTargetCellConfiguration;
trecTargetCellConfiguration *rx_TargetCellConfiguration_str;
rx_TargetCellConfiguration_str = (trecTargetCellConfiguration*)malloc(sizeof(trecTargetCellConfiguration));
send_TargetCellConfiguration_str->DRB_count=1;
send_TargetCellConfiguration_str->KenbStar = (UInt8*) malloc(1);
send_TargetCellConfiguration_str->KenbStar[0]= 0x5b;
sendto(sd, (char *) (send_TargetCellConfiguration_str), sizeof(tTargetCellConfiguration), 0, (struct sockaddr *)&server, slen)
服务器:
typedef struct tseTargetCellInformation{
UInt8 DRB_count;
UInt8 *KenbStar;
}tTargetCellConfiguration;
rx_TargetCellConfiguration_str->KenbStar = (UInt8*) malloc(1);
recvfrom(sd, (char *) (rx_TargetCellConfiguration_str), sizeof(trecTargetCellConfiguration), 0, (struct sockaddr*) &client, &client_length);