Skip to content

Fix #7415 System.Net.Sockets.Socket.Receive code example does not work. #7417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 1, 2021

Conversation

Dixin
Copy link
Contributor

@Dixin Dixin commented Nov 23, 2021

Summary

Fix System.Net.Sockets.Socket class's Receive method code example (https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.receive).

The original example does not work because it uses Socket.Available, which is 0 initially. You have to wait until the data is received, then Socket.Available will be the correct value.

Fixes #7415

@Dixin Dixin requested a review from a team as a code owner November 23, 2021 08:09
@ghost ghost added the area-System.Net label Nov 23, 2021
@ghost
Copy link

ghost commented Nov 23, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Summary

Fix System.Net.Sockets.Socket class's Receive method code example (https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.receive).

The original example does not work because it uses Socket.Available, which is 0 initially. You have to wait until the data is received, then Socket.Available will be the correct value.

Fixes #7415

Author: Dixin
Assignees: -
Labels:

area-System.Net

Milestone: -

@opbld34
Copy link

opbld34 commented Nov 23, 2021

Docs Build status updates of commit f1a1029:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CS/source.cs ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@karelz karelz requested a review from antonfirsov November 23, 2021 10:47
@opbld34
Copy link

opbld34 commented Nov 27, 2021

Docs Build status updates of commit 5991939:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CS/source.cs ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

Copy link
Contributor

@scalablecory scalablecory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks.

@scalablecory
Copy link
Contributor

@dotnet/docs what needs to be done re: this build failure?

@gewarren
Copy link
Contributor

We recently added a requirement for a project file so we can build the snippet. Simply add a .csproj file to the directory with the snippet and add the following content:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

</Project>

@opbld32

This comment has been minimized.

@opbld31
Copy link

opbld31 commented Dec 1, 2021

Docs Build status updates of commit 7739db2:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CS/Socket_Sync_Send_Receive.csproj ✅Succeeded
samples/snippets/csharp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CS/source.cs ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @Dixin !

@gewarren gewarren merged commit ae9da77 into dotnet:main Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Socket.Receive code example does not work
7 participants