SocketTaskExtensions.SendAsync Method (System.Net.Sockets) (original) (raw)
- Reference
Definition
Namespace:
Assemblies:
netstandard.dll, System.Net.Sockets.dll
Assembly:
System.Net.Sockets.dll
Assembly:
netstandard.dll
Assembly:
System.dll
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SendAsync(Socket, ReadOnlyMemory, SocketFlags, CancellationToken)
Source:
Source:
Source:
Source:
Sends data to a connected socket.
public static System.Threading.Tasks.ValueTask<int> SendAsync(this System.Net.Sockets.Socket socket, ReadOnlyMemory<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Threading.CancellationToken cancellationToken = default);
static member SendAsync : System.Net.Sockets.Socket * ReadOnlyMemory<byte> * System.Net.Sockets.SocketFlags * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<int>
<Extension()>
Public Function SendAsync (socket As Socket, buffer As ReadOnlyMemory(Of Byte), socketFlags As SocketFlags, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Integer)
Parameters
socket
The socket to perform the operation on.
cancellationToken
A cancellation token that can be used to signal the asynchronous operation should be canceled.
Returns
A task that completes with number of bytes sent to the socket if the operation was successful. Otherwise, the task will complete with an invalid socket error.
Exceptions
An error occurred when attempting to access the socket.
The cancellation token was canceled. This exception is stored into the returned task.
Applies to
SendAsync(Socket, ArraySegment, SocketFlags)
Source:
Source:
Source:
Source:
Sends data to a connected socket.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<int> ^ SendAsync(System::Net::Sockets::Socket ^ socket, ArraySegment<System::Byte> buffer, System::Net::Sockets::SocketFlags socketFlags);
public static System.Threading.Tasks.Task<int> SendAsync(this System.Net.Sockets.Socket socket, ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags);
static member SendAsync : System.Net.Sockets.Socket * ArraySegment<byte> * System.Net.Sockets.SocketFlags -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function SendAsync (socket As Socket, buffer As ArraySegment(Of Byte), socketFlags As SocketFlags) As Task(Of Integer)
Parameters
socket
The socket to perform the operation on.
Returns
An asynchronous task that completes with number of bytes sent to the socket if the operation was successful. Otherwise, the task will complete with an invalid socket error.
Exceptions
An error occurred when attempting to access the socket.
Applies to
SendAsync(Socket, IList<ArraySegment>, SocketFlags)
Source:
Source:
Source:
Source:
Sends data to a connected socket.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<int> ^ SendAsync(System::Net::Sockets::Socket ^ socket, System::Collections::Generic::IList<ArraySegment<System::Byte>> ^ buffers, System::Net::Sockets::SocketFlags socketFlags);
public static System.Threading.Tasks.Task<int> SendAsync(this System.Net.Sockets.Socket socket, System.Collections.Generic.IList<ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags);
static member SendAsync : System.Net.Sockets.Socket * System.Collections.Generic.IList<ArraySegment<byte>> * System.Net.Sockets.SocketFlags -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function SendAsync (socket As Socket, buffers As IList(Of ArraySegment(Of Byte)), socketFlags As SocketFlags) As Task(Of Integer)
Parameters
socket
The socket to perform the operation on.
Returns
An asynchronous task that completes with number of bytes sent to the socket if the operation was successful. Otherwise, the task will complete with an invalid socket error.
Exceptions
An error occurred when attempting to access the socket.