Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sockstat

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sockstat

A package that parses the /proc/net/sockstat file for socket connectivity statistics.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
increased by2900%
Maintainers
1
Weekly downloads
 
Created
Source

sockstat

npm version

A Node.js package that parses the /proc/net/sockstat file for socket connectivity statistics.

Usage

First, install the package using npm:

npm install sockstat --save

Then, start using the package by importing it and running the main function:

var sockstat = require('sockstat');

// Get current sockstat info
sockstat.get()
    .then(function (stats) {
        // Log stats
        console.log(stats);
    }).catch(function (err) {
        // Log error
        console.log(err);
    });

For the following /proc/net/sockstat:

sockets: used 123
TCP: inuse 19 orphan 105 tw 2115 alloc 132 mem 1638
UDP: inuse 1 mem 1
UDPLITE: inuse 0
RAW: inuse 0
FRAG: inuse 0 memory 0

The package returns the following output:

{
   "sockets": {
      "used": 123
   },
   "tcp": {
      "inuse": 19,
      "orphan": 105,
      "tw": 2115,
      "alloc": 132,
      "mem": 1638
   },
   "udp": {
      "inuse": 1,
      "mem": 1
   },
   "udplite": {
      "inuse": 0
   },
   "raw": {
      "inuse": 0
   },
   "frag": {
      "inuse": 0,
      "mem": 0
   }
}

Requirements

  • Node.js v6.x.x or newer

License

Apache 2.0

FAQs

Package last updated on 31 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc