TransmitFileByName

Description

Transmits the specified file in high performance mode by sending the file directly from the file cache.

Good to know: If you are creating a server that will transfer large files, this method can help send a file very efficiently with minimal coding.

Remarks

This method provides the highest available level of efficiency for transferring files. The return value from this method is a handle to the file.

Param
Description

SocketHandle

Socket to send on

FileToSend

File to send

ErrCode

Error code if unable to open file or the API fails, SocketQ will close the file handle regardless of the AutoCloseFile variable

AutoCloseFile

Indicates whether SocketQ should automatically close the file after the transfer. The default is true. If this flag is set to false, it is the applications responsibility to close the file.

NumberOfBytesToSend

Indicates the number of bytes from the file to transmit, by default this method transfers the entire file

SendBufferSize

Indicates the buffer size of each send operation in bytes

FileBytePosOffset

Indicates that the file transfer should start from this position in file

Flags

As listed below

Flag
Description

SSQ_TF_USE_DEFAULT_WORKER

Uses the systems default thread for sending

SSQ_TF_USE_SYSTEM_THREAD

Uses system threads for sending

SSQ_TF_USE_KERNEL_APC

Use Kernel APC instead

SSQ_TF_USE_DISCONNECT

Disconnect socket after sending

Prototype

LONG CSockQ::TransmitFileByName(long SocketHandle, CHAR* FileToSend, long *ErrCode, BOOL AutoCloseFile, long NumberOfBytesToSend, long SendBufferSize, long FileBytePosOffset, INT Flags)

Last updated