Coder Social home page Coder Social logo

asdlei99 / netsnoop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keyou/netsnoop

0.0 0.0 0.0 2 MB

A network snoop tool, support detect multi-client (which is not supported by iperf3 now) network (unicast/multicast) bandwith,delay,jitter,loss.

C++ 98.76% Makefile 1.24%

netsnoop's Introduction

netsnoop

Build Status

A network snoop tool, support detect multi-client (which is not supported by iperf3 now) network (unicast/multicast) bandwith,delay,jitter,loss.

Usage

$ ./netsnoop -h
usage:
  netsnoop -s <local ip> 4000         (start server)
  netsnoop -c <server ip> 4000        (start client)
  --------
  command:
  ping count 10                       (test delay)
  send count 1000                     (test unicast)
  send count 1000 multicast true      (test multicast)
  send speed 500 time 3000            (test unicast)
  
  version: v0.1.85 (Aug 28 2019 15:02:50)

In server side run:

netsnoop -s

In all clients run:

# Note: you must specif a NON-loopback ip to make multicast valid.
netsnoop -c <server_ip>

When all clients has connected, you can send commands like belows in server side:

# detect use default params.
ping # detect network delay and packet loss rate.
send # detect network bandwith and packet loss rate.
send multicast true # detect multicast bandwith.

# you can also specif params as you like.

# send 10 packets, send one packet every 200 milliseconds, every packet contains 1472 bytes data.
ping count 10 interval 200 size 1472

# send 200 packets, send one packet every 10 milliseconds, every packet contains 1472 bytes data.
# you can add 'multicast true' to detect multicast performance.
# you can add 'wait 500' to make client wait 500 milliseconds until stop receive data.
send count 200 interal 10 size 1472

# send in 500KB/s speed, 3000 milliseconds.
send speed 500 time 3000

Subcommands

ping Format:

ping [count <num>] [interval <milliseconds>] [size <num>] [wait <milliseconds>]

send Format:

send [count <num>] [interval <milliseconds>] [size <num>] [wait <milliseconds>] \
     [speed <KB/s>] [time <milliseconds>] [timeout <milliseconds>]

Advanced Usage

You can use script file with netsnoop to run multiple commands automatically:

# check script.snoop file contents.
$ cat script.snoop
peers 2
ping count 10
send count 100 interval 10 wait 500
sleep 5
send multicast true speed 100 time 3000

# run netsnoop as a server with a script file
$ netsnoop -s < script.snoop

The script.snoop file is a text file:

  • peers 2: wait until 2 peers connect;
  • sleep 5: wait 5 seconds;

Features

Currently, netsnoop support these 32 features:

Property Name Explain Notes
loss Loss Rate
(send/recv)_speed Send/Recv Speed
(send/recv)_avg_speed Average Send/Recv Speed
(max/min)_(send/recv)_speed Max/Min Send/Recv Speed
(send/recv)_packets Send/Recv Packets Count
illegal_packets Illegal Packets Count
reorder_packets Reorder Packets Count
duplicate_packets Duplicate Packets Count
timeout_packets Timeout Packets Count
(send/recv)_pps Send/Recv pps
(send/recv)_bytes Send/Recv Bytes
[(min/max)_](send/recv)_time Send/Recv Average/Min/Max Time
[(min/max)_]delay Packets Average/Min/Max Delay
jitter Packets Delay Jitter
jitter_std Jitter Standard Deviation
peers_count Connect Clients Count (when test start)
peers_failed Disconnect Clients Count

For developers

Welcome to expand more subcommands. This tool is not fully complete, although the code is friendly with unicast, it is not friendly with multicast now. Welcome to reflector the multicast code.

TODO:

  • Support 'recv' command which is revese of 'send'.
  • Support NAT environment.
  • Optimize multicast code.
  • Optimize command line arguements resolve code.
  • Refine documents about netsnoop_select, netsnoop_multicast.

Compile

Linux

In Linux alike system just run make.

And you can run make package to compile and pack the binary to zip archive. It will compile linux and win32 binaries(mingw needed.).

Windows

In windows system you should install mingw or msys2 first, then run make.

netsnoop's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.