**HMN-win32: Package for Windows Net API **
help
ddffsd Parts of this document were translated by machine (Gpt3.5)
Backwards compatible to node6.14.2 but the precompiled version is only supported to node8 and above (because node6 has no asynchronous syntactic sugar), for node6 please compile to node6.14.2 with esbuld yourself
HMN is a sub-branch of HMC-WIN32. Unlike HMC, HMN only handles network-related APIs.
Programming help (Chinese) help (English) CPP (source)
installation
How to call
let HMN = require ( "hmn-win32" ) ;
console . log ( "net:getConnectNetList=>" , hmn . getConnectNetList ( ) [ 0 ] )
In TypeScript using the
import HMC = require ( "hmn-win32" ) ;
Feature overview
API middle layer
- ref conversion
- bool Convert Boolean content to a safe bool type Boolean
- string converts text/pseudo-text content into safe text
- int converts numeric/pseudo-numeric content into safe int numbers
- HKEY HKEY objects in all registries
- Sleep asynchronous blocking
- native method of directly connecting to HMN.node (not recommended)
API
- ipv4 gets the ip (v4) of the local area network
- ip Gets the ip of the local area network (adapter, v4, v6)
- **adapterIP **Get the ip of the local area network (adapter, v4, v6)
- adapterIPAsync gets the ip of the local area network (adapter, v4, v6) [asynchronous async]
- public_ip gets the local public network ip [asynchronous async]
- getNetParams gets host network information
- getNetParamsAsync gets host network information
- freePort gets a tcp free port (service) [asynchronous async]
- freePortTCP gets a free tcp port [asynchronous async]
- freePortUDP gets a free udp port [asynchronous async]
- hasPortUDP determines whether this udp port is free [asynchronous async]
- hasPortTCP determines whether this TCP port is idle [asynchronous async]
- getSystemProxyServer Gets the system proxy link (only when system proxy is enabled)
- getSystemProxyPac Gets the system proxy pac script link
- getDomainIPaddress resolves domain name host ip from default dns (networking)
- getDomainIPaddressAsync resolves domain name host ip from default dns (networking) [asynchronous async]
- getHostsPath gets the path of the hosts file
- getTCPv6PortProcessID gets which process this port is occupied by
- getUDPv6PortProcessID Gets which process this port is occupied by
- getUDPv4PortProcessID Gets which process this port is occupied by
- getTCPv4PortProcessID gets which process this port is occupied by
- getTCPv6PortProcessIDAsync gets which process this port is occupied [asynchronous async]
- getUDPv6PortProcessIDAsync gets which process this port is occupied [asynchronous async]
- getUDPv4PortProcessIDAsync gets which process this port is occupied [asynchronous async]
- getTCPv4PortProcessIDAsync gets which process this port is occupied [asynchronous async]
- getConnectNetList enumerates the TCP and UDP port information of ports ipv4 and ipv6 in this computer
- getConnectNetListAsync enumerates the TCP and UDP port information of ports ipv4 and ipv6 in this computer [asynchronous async]
- killProcess ends the pid process (low rights, if you need to kill with high rights, please use hmc-win32)
- sleep synchronization blocking (process)
- Sleep asynchronous blocking (process)
- PortWatchdog detects port changes and initiates a callback if it is closed or enabled.
- getProcessidFilePath gets the process executable file location
- getProcessidFilePathAsync gets the process executable file location [asynchronous async]
- isAdmin determines whether the current software has administrator rights
Rebuild
All APIs of HMC are implemented using winapi + nodeapi, so there is no need to recompile (node6.14.2 is allowed to run in node8 or above environment and needs to be compiled with esbuld by itself). If you need to modify the source code, please use node-gyp rebuild
to compile, which requires Have a certain C/C++ foundation and use node-gyp as the compilation tool. The tools you need to use are as follows:
- node-gyp
- Visual Studio 2019 (or other versions)
Risk notification
Each functional module will be called more than a thousand times without a process crash.
The API has been strictly transcoded through js and is only required when calling native However, since both C++ and C languages are strictly typed, typeScript must be used strictly to pass types strictly.
Although it has undergone fatigue testing, there may still be unexpected process crashes, so it is recommended to run it under a child process.
C++'s wild pointers, null pointers, memory overflow, reference errors, type errors, etc. are all fatal to the process, so when writing new functions, you need to continuously conduct simulation fatigue tests