From 7123c301561b3d1f8631315a3f5fd2fea01c3a39 Mon Sep 17 00:00:00 2001 From: Aptivi Date: Tue, 3 Sep 2024 15:30:15 +0300 Subject: [PATCH] imp - Pinging normally needs no buffer --- To fix a Unix issue where non-superusers are unable to use ping, we need to change the PingAddress() function code so that they don't call the PingAddress() function with buffers. --- Type: imp Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- Kernel Simulator/Network/NetworkTools.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Kernel Simulator/Network/NetworkTools.cs b/Kernel Simulator/Network/NetworkTools.cs index ce52eae47c..ba2988bb04 100644 --- a/Kernel Simulator/Network/NetworkTools.cs +++ b/Kernel Simulator/Network/NetworkTools.cs @@ -67,11 +67,8 @@ public enum SpeedDialType /// A ping reply status public static PingReply PingAddress(string Address) { - _ = new Ping(); - _ = new PingOptions() { DontFragment = true }; - byte[] PingBuffer = Encoding.ASCII.GetBytes("Kernel Simulator"); - int Timeout = PingTimeout; // 60 seconds = 1 minute. timeout of Pinger.Send() takes milliseconds. - return PingAddress(Address, Timeout, PingBuffer); + int Timeout = PingTimeout; + return PingAddress(Address, Timeout); } /// @@ -81,10 +78,8 @@ public static PingReply PingAddress(string Address) /// A ping reply status public static PingReply PingAddress(string Address, int Timeout) { - _ = new Ping(); - _ = new PingOptions() { DontFragment = true }; - byte[] PingBuffer = Encoding.ASCII.GetBytes("Kernel Simulator"); - return PingAddress(Address, Timeout, PingBuffer); + var Pinger = new Ping(); + return Pinger.Send(Address, Timeout); } /// @@ -255,4 +250,4 @@ public static string GetFilenameFromUrl(string Url) } } -} \ No newline at end of file +}