Example #1
0
//-----------------------------------------------------------------------
//
//-----------------------------------------------------------------------
size_t SocketOStream::sendto (const void* buf, const size_t size, const SockAddr& dstAddr)
    throw (IOException)
{
    ssize_t result;

    result = ::sendto (m_fd, buf, size, 0, &(dstAddr.getSockaddr()), dstAddr.getSockaddrLen());
    if (result == -1)
        throw IOException (errno);

    return result;
}
Example #2
0
//-----------------------------------------------------------------------
//
//-----------------------------------------------------------------------
void SocketOStream::sendto (const char data, const SockAddr& dstAddr)
    throw (IOException)
{
    if (-1 == ::sendto(m_fd, &data, 1, 0, &(dstAddr.getSockaddr()), dstAddr.getSockaddrLen()))
        throw IOException (errno);
}