This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am3359 linux udp



1. beaglebone black开发板

2. linux系统,3.8内核

3. socket开发

问题如下:

1)sfd = socket( AF_INET, SOCK_DGRAM, 0 ); // 创建一个UDP socket,客户端

2)// 设置目标IP和PORT

struct sockaddr_in dest;

bzero( &dest, sizeof( struct sockaddr_in ) );
        
dest.sin_family      = AF_INET;
dest.sin_port        = htons( sock->dest_port );
inet_aton( sock->dest_ip, &dest.sin_addr );

3)// 发送buffer中内容,“APP is running.”

int st = sendto( sfd,\
                            udp_print_instance.buff,\
                             udp_print_instance.buff_size,
                             0,\
                             ( struct sockaddr * )&dest,\
                             sizeof( struct sockaddr_in ) );

返回值st大于0,网线连接电脑。

但是wireshark抓不到开发板发出的UDP数据包。

如果用电脑给开发板发UDP包,recvfrom可以完整接收数据,sendto发送不成功原因不明,求指点。