tags:

views:

39

answers:

1

With a WiFi connection, UDP data is not received. It stops at:

recvfrom(sock, buf, RECV_BUF_SIZE, 0, (SOCKADDR*)&rAddr, (SOCK_LEN*)&len);

When I run the same program in iPhone simulator over ethernet it works well. What am I missing?

A: 

Look at the man page.

Like so:

  recvfrom(mSock,recvBuff,1024,0,(struct sockaddr *)&from, &fromlen);

providing the parameter values you are setting are correct try this in your case try:

  recvfrom(sock, buf, RECV_BUF_SIZE, 0, (struct sockaddr *)&rAddr, &len);
Pavan
@Pavan: Signatures are redundant on SO, every post already has your name attached at the bottom. See [Meta](http://meta.stackoverflow.com/) for more details.
Roger Pate
I'm confused by your answer - the only change you seem to be suggesting is changing one cast and removing another cast. In C / ObjectiveC, that's not going to make any difference to how the code runs.
JosephH
joseph hav you tried NSLogging the variables first to make sure they have the right data contained within them? do that as a test
Pavan
Hi , when i send broadcast data over udp is not received in iphone,then i altered and then send the data over unicast (Given my ipaddress) then it receives udp data over wifi.Is anyother suggestion ?
Tamil