dotnet / dotnet/dotnet-api-docs

Ping behaviour on linux not documented (raw socket vs command)

Open
#3,609 2 comments 0 reactions 0 assignees View on GitHub
area-System.Net Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

# Ping behaviour on linux not documented (raw socket vs command)

Using `System.Net.NetworkInformation.Ping` class on linux can either use raw sockets, or `ping` command line utility as fallback when the current user does not have enough privileges.

The code is here : https://github.com/dotnet/corefx/blob/master/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs#L154

The documentation does not mention this (I hope I didn't missed it) : https://docs.microsoft.com/fr-fr/dotnet/api/system.net.networkinformation.ping?view=netstandard-2.0

Personally I expected it to fail without being `root`. I was surprised by the behaviour, and searched the explanation in the source code.

Someone could argue it's just an implementation detail, but as it could lead to severe performance problem when used *massively* it's important to be clear. And as the command line could not be always available it could also lead to different behaviour according to the execution environment (eg: full system vs container).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.