dotnet / dotnet/dotnet-api-docs

Socket.EndSend reference doc inaccuracy

Offen
#1,701 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area-System.Net doc-bug dotnet-api/prod Pri1
Vorherrschende Sprache
C#
Sterne
950
Forks
1.7k
Ø Merge
2 T. 19 Std.
Gemergte PRs (30 T.)
52

Beschreibung

This issue was reported by a .NET user a while ago via a different channel:

Hi alll, no authoritative response has been given on this in several discussions in the past, so I decided to report this as a documentation bug, because there is an obvious conflict in the documentation of the Socket.BeginSend and Socket.EndSend methods even in the latest .NET framework version. MSDN says in Socket.BeginSend: "When your application calls BeginSend, the system will use a separate thread to execute the specified callback method, and will block on EndSend until the Socket sends the number of bytes requested or throws an exception." From this sentence I infer, that BeginSend queues ALL data for sending or there will be an exception. But let's have a look what MSDN says in Socket.EndSend: "If you are using a connection-oriented protocol, EndSend will block until some of the buffer was sent. If the return value from EndSend indicates that the buffer was not completely sent, call the BeginSend method again, modifying the buffer to hold the unsent data." This sentence says, that EndSend might succeed even with less bytes sent than requested for connection-oriented protocols. Since it is realy important to know what the real behaviour of these methods is, the documentation should be fixed (or clariefied) to make this very old problem finally clear. According to our tests EndSend never returns less bytes than requested when it succeeds even for very large (MB) sents. So can you please explain to the public the behaviour of these two methods? Does it play a role if the socket is set to nonblocking? Thank you very much. Alex

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 81f71ba2-4ddb-acf3-f556-36c4b0a1c0a4
* Version Independent ID: 50fe175a-aac1-78e9-4a95-28e68c3c54d5
* Content: [Socket.BeginSend Method (System.Net.Sockets)](https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.beginsend?view=netframework-4.7.2)
* Content Source: [xml/System.Net.Sockets/Socket.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net.Sockets/Socket.xml)
* Product: **dotnet-api**
* GitHub Login: @karelz
* Microsoft Alias: **ncldev**

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit xml/System.Net.Sockets/Socket.xml und vergleichen Sie die im Issue verknüpften Einträge zu Socket.BeginSend und Socket.EndSend. Überprüfen Sie das dokumentierte Verhalten für verbindungsorientierte und nicht blockierende Sockets und aktualisieren Sie anschließend die widersprüchliche Formulierung, sodass das Verhalten beim Abschluss des Sendens und bei partiellen Sendungen eindeutig ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
documentation, networking
Issue-Typ
Dokumentation
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.