Comments (5)
This is quite tricky, and would be something the raw-socket module (also my module) would have to support.
Are you enquiring specifically about QoS support for ICMP ping messages, or QoS for packets in general?
from node-net-ping.
Right now specifically for ICMP ping messages, but a general QoS support for the raw-socket module might open some possibilities for me to develop tools at my work.
from node-net-ping.
For Windows it's not simple, and would require using the QoS API specifically exposed to work with QoS, something that would not be done anytime soon I'm afraid because of work commitments.
If you are working with Linux however, you could try the IP_TOS
socket option. First identify the value for your local system (using IPTOS_THROUGHPUT
here as an example):
$ grep -R IP_TOS /usr/include/*
/usr/include/bits/in.h:#define IP_TOS 1 /* int; IP type of service and precedence. */
/usr/include/linux/in.h:#define IP_TOS 1
...
$ grep -R IPTOS_THROUGHPUT /usr/include/*
/usr/include/linux/ip.h:#define IPTOS_THROUGHPUT 0x08
/usr/include/netinet/ip.h:#define IPTOS_THROUGHPUT 0x08
...
Then use this to set the socket option before you use the net-ping session (assumes latest version of net-ping):
var ping = require("net-ping")
var raw = require("raw-socket")
var session = ping.createSession(...)
var level = raw.SocketLevel.IPPROTO_IP
var option = 1 // IP_TOS
var value = new Buffer([0x08]) // IPTOS_THROUGHPUT
session.getSocket().setOption(level, option, value, value.length)
// Then go on to session.pingHost() etc.
See the raw-socket docs for more information on the setSocket()
method.
Steve
from node-net-ping.
Just realised, we already expose the IP_TOS
option, so this would actually be:
var ping = require("net-ping")
var raw = require("raw-socket")
var session = ping.createSession(...)
var level = raw.SocketLevel.IPPROTO_IP
var option = raw.SocketOption.IP_TOS
var value = new Buffer([0x08]) // IPTOS_THROUGHPUT
session.getSocket().setOption(level, option, value, value.length)
// Then go on to session.pingHost() etc.
from node-net-ping.
Sorry for the delay, I've been dragged with another things at work, I'll try it when I find time to code it, it looks really promising.
Thanks for the help!
from node-net-ping.
Related Issues (20)
- Can't create IPv6 session on macOS HOT 4
- Documentation could be clearer HOT 1
- Can you surport ping Domain ? HOT 1
- Getting Error with code from docs HOT 2
- Operation not permitted HOT 1
- Output's body on Windows does not necessary contains 'ms' words HOT 2
- Expected handling of RedirectReceivedError
- Cannot ping IPv4 ip's with port's HOT 2
- Unable to install net-ping HOT 2
- npm install net-ping crashing HOT 3
- Permission denied to create raw sockets in Linux ubuntu HOT 1
- Refer for Ping Statistics as No OF packets sent and received HOT 1
- Typo? HOT 1
- pingHost sometimes not running
- After "promisifying" net-ping resolve fire after timeout and not immediately HOT 1
- Random raw-socket error
- Unable to execute net-ping HOT 1
- Is there a 2 seccond delay? HOT 1
- Ping not working on Ping Redirect (Type 5)
- npm install fails in April 2024 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-net-ping.