UDT Reference: UDT Functions

getoverlappedresult

The getoverlappedresult method retrieves the status of an overlapped IO.

bool getoverlappedresult(
  UDTSOCKET u,
  const int& handle,
  int& progress,
  const bool& wait
);

Parameters

u
[in] Handle to a connected socket.
handle
[in] Handle to the overlapped IO.
progress
[out] amount of data sent or received.
wait
[in] indication if the call should wait for the completion of the overlapped IO.

Return Values

If wait is true, true is returned for a success call - the IO is completed; otherwise false is returned if there are errors. The specific error information can be found by getlasterror.

If wait is false, true is returned if the IO has been completed. If the IO is still in progress, false is returned, and the number of bytes transferred is indicated in progress. A returned value of false can also indicates errors, in which case the progress is set to -1.

Error Code Comment

2001

connection is broken before the IO completes.

2002 connection does not exist.

5003

no overlapped IO is associated with the given handle.

5004

u is an invalid UDT socket.

Description

The getoverlappedresult method retrieves the status of an overlapped IO associated with the handle. If wait is true, this method will wait until the IO is completed. Otherwise it returns immediately and indicates the IO progress in progress.

Note: In the current implementation, IO handle cannot be verified. If an invalid handle is passed to the call, true is always returned and the progress will be zero. That is, when this method returns true, the value of progress is meaningless. On the other hand, if the method returns false, the value of progress should be check to see if there are errors or the IO is not completed.

See Also

send, recv