LabVIEW基于Netstat列出活动的网络连接1

简介: LabVIEW基于Netstat列出活动的网络连接

LabVIEW基于Netstat列出活动的网络连接

该VI使用命令行“netstat”查询网络堆栈中的活动网络连接。除了连接状态之外,还会返回活动的本地和外部 IP 地址和端口号。

连接状态:Netstat 返回每个网络连接的状态,如下表所示。

State

Description

LISTEN

accepting connections

ESTABLISHED

connection up and passing data

image.png

程序截图如下所示。

更多的介绍,参见如下介绍,原文: http://linux-ip.net/html/tools-netstat.html

G.4. netstat

The netstat utility summarizes avariety of characteristics of the networking stack. With netstat you can learn a numberof important things. If no other type of data is requested it will report onthe state of all active sockets. You can however request the routingtable, masquerading table, network interface statistics, and networkstack statistics [60].

G.4.1. Displaying socket status with netstat

One of the most common uses ofthe netstat utilityis to determine the state of sockets on a machine. There are many questionsthat netstat cananswer with the right set of options. Here's a list of some of the thingsdifferent things we can learn.


·       whichservices are listening on which sockets


·       whatprocess (and controlling PID) is listening on a given socket


·       whetherdata is waiting to be read on a socket


·       whatconnections are currently established to which sockets


Byinvoking netstat withoutany options, you are asking for a list of all currently open connections to andfrom the networking stack on the local machine. This means IP networkconnections, unix domain sockets, IPX sockets and Appletalk sockets amongothers. Naturally, we'll skip over the non-IP sockets since this is about IPnetworking with linux.


Assumethe --inet switchin all cases below unless we are examining a particular higher layer protocol(e.g., TCP with the --tcp switch or UDP with --udp switch.


Aconvenient feature of netstat isits ability to differentiate between two different sorts of name lookup.Normally the -n specifies no name lookup, butthis is ambiguous when there are hostnames, port names, and user names.Fortunately, netstat offersthe following options to differentiate the different forms of lookup andsuppress only the [un-]desired lookup.


·       --numeric-hosts


·       --numeric-ports


·       --numeric-users


Theoption -n (my favorite), suppress all hostname, port name andusername lookup, and is a synonym for --numeric. I'll reiterate that hostnames andDNS in particular can be confusing, or worse, misleading when trying todiagnose or debug a networking related issue, so it is wise to suppresshostname lookups in these sorts of situations.


In Example G.11,“Displaying IP socket status with netstat” we will look at netstat's numeric output and thenwe'll invoke the same command but suppress the host lookups. Though the outputis almost the same, a particular situation might call for one or the otherinvocation.


Example G.11. DisplayingIP socket status with netstat

[root@morgan]# netstat --inet -n
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0    192 192.168.98.82:22        192.168.99.35:40991     ESTABLISHED
tcp        0      0 192.168.98.82:42929     192.168.100.17:993      ESTABLISHED
tcp       96      0 127.0.0.1:40863         127.0.0.1:6010          ESTABLISHED
tcp        0      0 127.0.0.1:6010          127.0.0.1:40863         ESTABLISHED
tcp        0      0 127.0.0.1:38502         127.0.0.1:6010          ESTABLISHED
tcp        0      0 127.0.0.1:6010          127.0.0.1:38502         ESTABLISHED
tcp        0      0 192.168.98.82:53733     209.10.26.51:80         SYN_SENT
tcp        0      0 192.168.98.82:44468     192.168.100.17:993      ESTABLISHED
tcp        0      0 192.168.98.82:44320     192.168.100.17:139      TIME_WAIT
[root@morgan]# netstat --inet --numeric-hosts
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 192.168.98.82:ssh       192.168.99.35:40991     ESTABLISHED
tcp        0      0 192.168.98.82:42929     192.168.100.17:imaps    ESTABLISHED
tcp        0      0 127.0.0.1:40863         127.0.0.:x11-ssh-offset ESTABLISHED
tcp        0      0 127.0.0.:x11-ssh-offset 127.0.0.1:40863         ESTABLISHED
tcp        0      0 127.0.0.1:38502         127.0.0.:x11-ssh-offset ESTABLISHED
tcp        0      0 127.0.0.:x11-ssh-offset 127.0.0.1:38502         ESTABLISHED


tcp        0      0 192.168.98.82:53733     209.10.26.51:http       SYN_SENT
tcp        0      0 192.168.98.82:44468     192.168.100.17:imaps    ESTABLISHED
tcp        0      0 192.168.98.82:44320     192.168.100:netbios-ssn TIME_WAIT

LabVIEW基于Netstat列出活动的网络连接2:https://developer.aliyun.com/article/1505743

相关文章
|
8天前
|
监控 Linux 测试技术
LabVIEW网络服务器何使用,有哪些不同
LabVIEW网络服务器何使用,有哪些不同
15 1
|
8天前
|
网络协议
LabVIEW中如何在网络上使用远程VI服务器
LabVIEW中如何在网络上使用远程VI服务器
13 2
|
8天前
|
机器学习/深度学习 传感器 芯片
LabVIEW利用人工神经网络辅助进行结冰检测
LabVIEW利用人工神经网络辅助进行结冰检测
13 0
|
8天前
|
监控 网络安全
LabVIEW开发干扰对无线网络基础设施进行隐蔽影响测试
LabVIEW开发干扰对无线网络基础设施进行隐蔽影响测试
22 0
|
8天前
|
机器学习/深度学习 传感器 算法
LabVIEW开发基于神经网络的自动汽车制动系统
LabVIEW开发基于神经网络的自动汽车制动系统
14 0
|
8天前
|
JSON 网络协议 调度
LabVIEW开发TCP网络通讯程序4
LabVIEW开发TCP网络通讯程序4
13 0
|
8天前
|
XML JSON 网络协议
LabVIEW开发TCP网络通讯程序3
LabVIEW开发TCP网络通讯程序3
10 1
|
8天前
|
网络协议 测试技术
LabVIEW开发TCP网络通讯程序2
LabVIEW开发TCP网络通讯程序2
14 2
|
8天前
|
网络协议
LabVIEW开发TCP网络通讯程序1
LabVIEW开发TCP网络通讯程序1
13 1
|
8天前
|
移动开发 网络协议 Unix
LabVIEW基于Netstat列出活动的网络连接2
LabVIEW基于Netstat列出活动的网络连接
13 1

热门文章

最新文章