Question

I have been using UDT library a udp based protocol for sending files and I notice that the send function sends the data to a buffer before returning in blocking mode. However the send function seems to return without sending the entire data in blocking mode(send() returns the amount of data sent). What could be the possible reason for this prob and what should be done to send the remaining data if the prob cannot be solved? I used winsock library for tcp and udp but i dont get this prob for tcp or udp send(similiar in functionality to udt). Tested all the programs by transferring same files & network.

    int a;
    if (UDT::ERROR == (a = UDT::send(*(UDTSOCKET*)sock, buffer, size, 0)))
    {
        cout << "send: " << UDT::getlasterror().getErrorMessage() << endl;
        return -1;
    }
    else
    {
        return a;
    }
    This is the code i use. the value of 'a' is not the same as 'size' at times.                     

I know this can happen if its non-blocking but i am using blocking send with infinite timeout.

Was it helpful?

Solution

If you have a send timeout set, this is probably a timeout. If not, you can consider this an error that is fatal to the connection. You can call getlasterror to find out what went wrong.

OTHER TIPS

UDP datagrams are sent entire or not at all. The situation you describe is impossible. Please provide your evidence.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top