Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,9 @@ private void ProcessTraceroute(string targetNameOrAddress)
? reply.RoundtripTime
: timer.ElapsedMilliseconds,

// If we use the empty buffer, then .NET actually uses a 32 byte buffer so we want to show
// as the result object the actual buffer size used instead of 0.
buffer.Length == 0 ? DefaultSendBufferSize : buffer.Length,
// If we use the empty buffer for default size, we want to show
// the requested BufferSize (32) instead of the actual buffer length (0).
Comment on lines +488 to +489
BufferSize,
pingNum: i);
WriteObject(new TraceStatus(
currentHop,
Expand Down Expand Up @@ -732,7 +732,7 @@ private void ProcessPing(string targetNameOrAddress)
resolvedTargetName,
reply,
reply.RoundtripTime,
buffer.Length == 0 ? DefaultSendBufferSize : buffer.Length,
BufferSize,
pingNum: (uint)i));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ Describe "Test-Connection" -tags "CI", "RequireSudoOnUnix" {
$result.BufferSize | Should -Be 2
}

It "BufferSize 0 works and returns 0" {
$result = Test-Connection $targetName -Count 1 -BufferSize 0

$result.BufferSize | Should -Be 0
}

It "ResolveDestination for address" {
$result = Test-Connection $targetAddress -ResolveDestination -Count 1
$resolvedName = [System.Net.DNS]::GetHostEntry($targetAddress).HostName
Expand Down