Hi,
I'm using CCSv4 with NDK 2.20.04.26, BIOS 6.30.02.42, IPC 1.21.02.23, XDCTOOLS 3.20.03.63, and XDAIS 7.10.00.06.
I'm using raw socket programming to send and receive UDP messages in a multithreaded application. If I use a command line to send a UDP packet to my board at it's bound address/port, I receive the packet fine and can process the data. However, when I send a message to the broadcast IP address (255.255.255.255), the board doesn't show any messages received. I think it might have something to do with the EMAC RX Filter but I don't know how to determine what it's currently set as (like EMAC_RXFILTER_ALL or EMAC_RXFILTER_NOTHING).
Another somewhat related question: if using socket programming, do calls to NETCNTL functions like NC_SystemOpen( ) affect the functionality of the MAC layer for non-NETCNTL tasks? I have a Daemon function running separately from my UDP task and I'm not sure how much the NC_.... calls are related to general send( )/recv( ). For instance, if I wanted to remove the Daemon, would a UDP recvnc( ) call still work if I no longer call NC_SystemOpen( ) and all the other NC_... setup functions?
Thanks,
Nick
Arun:
Hi! I have a similar problem with Nick's,and look for your help~
I use DM642 as a server to receive broadcast message from PC.I tried to use PC to PC,it works,but PC to DSP,it failed.
My procedure run on DM642:
1. fdOpenSession(TaskSelf()); 2. bzero( &broadaddr, sizeof(struct sockaddr_in) ); broadaddr.sin_addr.s_addr = inet_addr("192.168.1.77"); broadaddr.sin_family = AF_INET; broadaddr.sin_port = htons(7000); broadaddr.sin_len = sizeof(broadaddr);
3. broadsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
4. setsockopt(broadsock,SOL_SOCKET,SO_RCVTIMEO,&timeout,sizeof(timeout));
setsockopt(broadsock,SOL_SOCKET,SO_BROADCAST,&so_broadcast,sizeof(int));
setsockopt(broadsock,SOL_SOCKET,SO_IFDEVICE,(void *)&so_broadcast,sizeof(int));
5. bind(broadsock,&broadaddr,len);
6. recvfrom(broadsock,(void *)buf,100,MSG_WAITALL,(PSA)&broadClient,&len);
7.fdCloseSession(TaskSelf()); TaskBlock(TaskSelf());
My client code runs on PC,and code above runs on DM642. On CCS,I use watch window to check buf,it has nothing.
what 's the problem?is there anything wrong with Filter or NDK configuration?
Rong Zeng,
Which version of the NDK are you using?
There is a bug in the stack that causes (non-daemon) tasks to not receive broadcast packets:
SDOCM00086184 NDK tasks are unable to receive broadcast packets (while daemon tasks can)
The resolution is discussed in this forum thread, please refer to the thread post I made on 11-07-2011 9:54 PM
If you are using an NDK that has shipped source code, you can apply the fix shown in that thread and rebuild your stack library. Then rebuild your app against the newly rebuilt library and you should be able to receive broadcast packets from within your task.
Steve