- SendResult.OK — transfer queued successfully
- SendResult.CLOSED — connection not in CONNECTED state
- SendResult.ERROR — system error
TcpConnection.sendFile
Send a file over the connection using zero-copy TransmitFile.
When IOCP overlapped mode is active and TransmitFile is available, the file is transferred directly from kernel file buffers to the socket without copying through userspace. Falls back to regular send() in WSAPoll mode.
The file handle is closed after the transfer completes or on error. The caller must not close the handle after calling this method.
Parameters
fileHandle | Win32 file handle (opened with FILE_FLAG_OVERLAPPED for IOCP mode). Ownership transfers to the connection. |
offset | Byte offset to start sending from. |
count | Number of bytes to send (0 = entire file from offset). |