• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re:Can not receive packages from opened socket
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Can not receive packages from opened socket


  • Subject: Re:Can not receive packages from opened socket
  • From: Robin <email@hidden>
  • Date: Wed, 1 Nov 2006 17:43:32 +0800

Hi, John

After I specify the types of packets with setsockopt(), I can get the data now. But there's a new question now, the recvfrom() sometimes read back 0 bytes, then it will keep on getting 0 bytes in the ring thread. When it return -1 one times, it will get the right length data packets then.

I filled the recvfrom() as this,

While(true)
{
int nFlag = MSG_TRUNC;
int nRead =0;
unsigned int addrlen;
addrlen = sizeof(saddr);
memset(&saddr,0, addrlen);

if(options & CA_NONBLOCKING) //NO_BLOCK MODE
{
nFlag |= MSG_DONTWAIT;
}

nRead = recvfrom(>fd_recv, buffer, len, nFlag , &(saddr), &addrlen);

if(nRead > 0)
{
fprintf (stderr, "receive package OK,  get %d byetes ... \n", nRead);
}
}

I guess there's still something wrong with the setting, for it's a random phenomenon that the application read 0 bytes and read real data.

Do you have any suggestion? 

Thank you very much!

Best regards,
Robin
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Next by Date: Preventing a Network Service from becoming Primary
  • Next by thread: Preventing a Network Service from becoming Primary
  • Index(es):
    • Date
    • Thread