TransmitFileOptions Enumeration

The TransmitFileOptions enumeration defines values used in file transfer requests.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

'Declaration
<FlagsAttribute> _
Public Enumeration TransmitFileOptions

Member nameDescription
DisconnectStart a transport-level disconnect after all the file data has been queued for transmission. When used with ReuseSocket, these flags return the socket to a disconnected, reusable state after the file has been transmitted.
ReuseSocketThe socket handle may be reused when the request completes. This flag is valid only if Disconnect is also specified. When used with Disconnect, these flags return the socket to a disconnected, reusable state after the file has been transmitted.
UseDefaultWorkerThreadUse the default thread to process long file transfer requests.
UseKernelApcUse kernel asynchronous procedure calls (APCs) instead of worker threads to process long file transfer requests. Long requests are defined as requests that require more than a single read from the file or a cache; the request therefore depends on the size of the file and the specified length of the send packet.
UseSystemThreadUse system threads to process long file transfer requests.
WriteBehindComplete the file transfer request immediately, without pending. If this flag is specified and the file transfer succeeds, the data has been accepted by the system but not necessarily acknowledged by the remote end. Do not use this flag with the Disconnect and ReuseSocket flags.

Note   The flags Disconnect and ReuseSocket return the socket to a disconnected, reusable state after the file has been transmitted. These flags should not be used on a socket where quality of service (QOS) has been requested, because the service provider might immediately delete any quality of service associated with the socket before the file transfer has completed. The best approach for a QOS-enabled socket is to call Close when the file transfer has completed, rather than relying on these flags.

The following example demonstrates the use of TransmitFileOptions in a call to SendFile. The file "test.txt" is located in the root directory of the local machine. In this example, a prebuffer and postbuffer of data are created and sent to the remote host with the file. To use the system's default thread, UseDefaultWorkerThread is specified.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft