In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you how the Linux system to check socket status, the content is easy to understand, clear, hope to help you solve doubts, the following let the editor to take you to study and learn "Linux system how to check socket status" this article.
Socket's API is set on the basis of a three-way handshake and four waves, so how to check the status of socket in the Linux system? The following is to share with you the specific methods of Linux system to view socket.
Introduction to socket: socket is the abstraction of communication endpoints, and its English socket means socket and hole.
If two machines want to communicate through a line in the middle, the two ends of this line should connect both sides of the communication, and the access point of this line on each machine is socket, that is, the Jack, so before communication, we must set up this Jack at both ends of the communication. At the same time, in order to ensure correct communication, the jacks between the end and the end must correspond one by one, so that the two ends can communicate correctly. And this Jack corresponds to our actual operating system, that is, the socket file, and after we create it, we will get a descriptor returned by the operating system for the file, and then the application can access the socket by using the socket descriptor, write input to it, and read the data.
From a level closer to the system, the way of communication between the two machines is nothing more than TCP/UDP of the transport layer, IP of the network layer, so socket is essentially a programming interface (API), encapsulation of TCP/UDP/IP, TCP/UDP/IP should also provide an interface for programmers to do network development, which is the Socket programming interface.
Check the socket status in Linux: cat / proc/net/sockstat # (this is ipv4)
Sockets: used 137 TCP: inuse 49 orphan 0 tw 3272 alloc 52 mem 46UDP: inuse 1 mem 0RAW: inuse 0 FRAG: inuse 0 memory 0
Description: sockets: used: total number of all protocol sockets used TCP: inuse: number of TCP sockets in use (listening). Its value ≤ netstat-lnt | grep ^ tcp | wc-lTCP: orphan: the number of TCP connections without owners (not belonging to any process) (useless, TCP socket to be destroyed) TCP: tw: the number of TCP connections waiting to be closed. Its value is equal to netstat-ant | grep TIME_WAIT | wc-lTCP:alloc (allocated): the number of TCP sockets assigned (established and applied for sk_buff). Its value is equal to netstat-ant | grep ^ tcp | wc-lTCP:mem: socket buffer usage (unknown units). Measured with scp, speed at 4803.9kB/s: value = 11 Recv-Q=0,Send-Q ≈ of port 22 in ant netstat-ant) UDP:inuse: number of UDP sockets in use RAW:FRAG: number of IP segments used
For IPv6, please see: cat / proc/net/sockstat6
TCP6: inuse 3UDP6: inuse 0RAW6: inuse 0 FRAG6: inuse 0 memory 0
With these values, you can easily calculate the current number of tcp requests and then monitor them.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
The above is about "how to check socket status in Linux system". If this article is helpful and well written, please share it with your friends to learn new knowledge. if you want to know more about it, please pay more attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.