0

这是不正确的吗?

ssize_t rc;
do
{
    rc = ::sendto(fd_, (char*) &fooStruct, sizeof(fooStruct), 0, &sockAddr_, sizeof(sockAddr_));
} while ((rc == -1 && errno == EINTR));

if (rc < 0)
    cout << "failed to mcast message " << endl;

它似乎一直在失败,我想知道我是否应该这样做:

ssize_t rc = ::sendto(fd_, (char*) &fooStruct, sizeof(fooStruct), 0, &sockAddr_, sizeof(sockAddr_));
if (rc < 0) 
    cout << "failed to mcast message " << endl;
4

0 回答 0