From 6efb3d4ba12445648d013e9d5c21f5b515786698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=A1=82=E7=BA=B2?= Date: Fri, 26 Jan 2024 09:32:26 +0800 Subject: [PATCH] fix of the offset error --- src/CloudKit/Centos/Commands/netstat.vb | 2 +- src/Darwinism/Platform/Centos.vb | 2 +- test/linux/netstat.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CloudKit/Centos/Commands/netstat.vb b/src/CloudKit/Centos/Commands/netstat.vb index 7f2eb93..af9e6c6 100644 --- a/src/CloudKit/Centos/Commands/netstat.vb +++ b/src/CloudKit/Centos/Commands/netstat.vb @@ -63,7 +63,7 @@ Public Class netstat Return End If - For i As Integer = offset.i To lines.Length - 1 + For i As Integer = offset.i + 1 To lines.Length - 1 If Not lines(i).StringEmpty Then Dim tokens As String() = lines(i).StringSplit("\s+") diff --git a/src/Darwinism/Platform/Centos.vb b/src/Darwinism/Platform/Centos.vb index 4af60d7..1878e1f 100644 --- a/src/Darwinism/Platform/Centos.vb +++ b/src/Darwinism/Platform/Centos.vb @@ -32,7 +32,7 @@ Public Module CentosTools Call df.add("Foreign Address", netstat.Select(Function(a) a.ForeignAddress)) Call df.add("State", netstat.Select(Function(a) a.State)) Call df.add("PID/Program name", netstat.Select(Function(a) a.Program)) - Call df.add("listened_port", netstat.Select(Function(a) If(a.LocalListenPort <= 0, Double.NaN, a.LocalListenPort))) + Call df.add("listened_port", netstat.Select(Function(a) a.LocalListenPort)) Return df End Function diff --git a/test/linux/netstat.R b/test/linux/netstat.R index f7ce4a3..cc199fe 100644 --- a/test/linux/netstat.R +++ b/test/linux/netstat.R @@ -23,4 +23,4 @@ udp6 0 0 :::5353 :::* "; -print(centos::netstat(text1)); \ No newline at end of file +print(as.data.frame(centos::netstat(text1))); \ No newline at end of file