tags:

views:

48

answers:

0

Hi

I want to receive UDP packets one by one from the port which is sending infinite UDP packets. For that I have used recvfrom(). But after that call, packet is not getting stored in a buffer. So could you please tell me how to receive one by one????Thanks in advance....Following is my code...

int cnt =10;
while(recv)
{
  result = recvfrom(sockID, udpBuf, sizeof(udpBuf), 0,(struct sockaddr *)&fepAddr, &sock_len);
  fwrite(udpBuf, recvResult, 1, udp);
  memset(udpBuf, 0, sizeof(udpBuf));
  cnt--;
  if(cnt == 0)
    recv = 0;
}