TcpClient.SendBufferSize Proprietà
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta la dimensione del buffer di invio.
public:
property int SendBufferSize { int get(); void set(int value); };
public int SendBufferSize { get; set; }
member this.SendBufferSize : int with get, set
Public Property SendBufferSize As Integer
Dimensione del buffer di invio in byte. Il valore predefinito è 8192 byte.
L'esempio di codice seguente imposta e ottiene le dimensioni del buffer di invio.
//sets the send buffer size using the SendBufferSize public property.
tcpClient->SendBufferSize = 1024;
// gets the send buffer size using the SendBufferSize public property.
if ( tcpClient->SendBufferSize == 1024 )
Console::WriteLine( "The send buffer was successfully set to {0}", tcpClient->SendBufferSize );
// Sets the send buffer size using the SendBufferSize public property.
tcpClient.SendBufferSize = 1024;
// Gets the send buffer size using the SendBufferSize public property.
if (tcpClient.SendBufferSize == 1024)
Console.WriteLine ("The send buffer was successfully set to " + tcpClient.SendBufferSize.ToString ());
'Sets the send buffer size using the SendBufferSize public property.
tcpClient.SendBufferSize = 1024
' Gets the send buffer size using the SendBufferSize public property.
If tcpClient.SendBufferSize = 1024 Then
Console.WriteLine(("The send buffer was successfully set to " + tcpClient.SendBufferSize.ToString()))
End If
La SendBufferSize
proprietà ottiene o imposta il numero di byte che si prevede di inviare in ogni chiamata al NetworkStream.Write metodo . Questa proprietà modifica effettivamente lo spazio del buffer di rete allocato per l'operazione di invio.
Il buffer di rete deve essere almeno grande quanto il buffer dell'applicazione per garantire che i dati desiderati vengano archiviati e inviati in un'unica operazione. Utilizzare la SendBufferSize proprietà per impostare questa dimensione. Se l'applicazione invierà dati in blocco, è necessario passare il Write
metodo un buffer dell'applicazione molto grande.
Se il buffer di rete è inferiore alla quantità di dati forniti dal Write
metodo , verranno eseguite diverse operazioni di invio di rete per ogni chiamata effettuata al Write
metodo . È possibile ottenere una maggiore velocità effettiva dei dati assicurandosi che il buffer di rete sia almeno grande quanto il buffer dell'applicazione.
Prodotto | Versioni |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.3, 1.4, 1.6, 2.0, 2.1 |
Feedback su .NET
.NET è un progetto open source. Seleziona un collegamento per fornire feedback: