各位大神,各位TI工程师好!
我在开发我公司的C6678板卡的网络遇到这样的问题,我参考的NDK里的Client例程弄的,目前TCP协议都通信传输数据正常。现在我要实现DSP采用UDP协议主动往指定IP地址和端口号的PC机发数据的功能,因为要主动发送,我采用的是老的TaskCreate创建任务线程方式。在该任务里主动发送发现Sendto函数返回值也正确,但就是PC机上的网络调试助手收不到数据?以下是我的代码,看下是否有问题:
- SOCKET socClient = socket(AF_INET, SOCK_DGRAM, 0);
- SOCKADDR_IN addrSrv; // a instance of SOCKADDR_IN, which is used in format of SOCKADDR.
- addrSrv.sin_addr.S_un.S_addr=inet_addr("192.168.10.119"); //set the host IP
- addrSrv.sin_family=AF_INET; //set the protocol family
- addrSrv.sin_port=htons(HOST_PORT); //set the port number
- // array to store the data that server feedback.
- char cRecvBuf[100];
- //while
- while(true){
- sendto(socClient, cRecvBuf, 100, 0, (SOCKADDR*) &addrSrv, sizeof(SOCKADDR));
- }