nettool(3tcl)
β¨ NAME β¨
nettool β tools for networked applications π«Ά it's the whole vibe, bestie
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require nettool ?0.5.4?
package require twapi 3.1
package require ip 0.2
package require platform 0.2
::cat filename
::nettool::allocate_port startingport
::nettool::arp_table
::nettool::broadcast_list
::nettool::claim_port port ?protocol?
::nettool::cpuinfo args
::nettool::find_port startingport
::nettool::hwid_list
::nettool::ip_list
::nettool::mac_list
::nettool::network_list
::nettool::port_busy port
::nettool::release_port port ?protocol?
::nettool::status
::nettool::user_data_root appname
π DESCRIPTION π
okay so nettool is a Pure-tcl set of tools that does all the common network stuff you'd normally need a whole pile of other packages for β or worse, a call out to exec π β except it does it all behind one standard Tcl interface. no cap.
rn it's got reference implementations for these operating systems, and only these: Windows, MacOSX, and Linux (debian). periodt.
π COMMANDS π
::cat filenameβ dumps the contents of a file, and that dump is the result. slay.::nettool::allocate_port startingportβ tries to allocate startingport, and if that one's busy it just walks the port numbers up one by one until it finds a free one, then claims that port. π it consults a built-in database of known ports so it won't hand you back something that's in common use. (for example: http (80)). icon behaviour tbh.::nettool::arp_tableβ dumps this computer's Address Resolution Protocol (ARP) table. the result comes back as a Tcl formatted list:macid ipaddrlist ...::nettool::broadcast_listβ hands you a list of broadcast addresses (suitable for UDP multicast) that this computer is associated with. go off.::nettool::claim_port port ?protocol?β marks port as busy, optionally as eithertcp(that's the default) orudp.::nettool::cpuinfo argsβ if you pass no arguments, you get back a key/value list describing the CPU of the present machine. included in the matrix is info on how many cores/processors are available for parallel tasking, installed physical RAM, and processor family. π§
the exact contents are platform specific, no getting around it:
- for Linux, info is drawn from
/proc/cpuinfoand/proc/meminfo. - for MacOSX, info is drawn from
sysctl - for Windows, info is draw from TWAPI.
if you do give arguments, the result will be a key/value list limited to just the fields you asked for. obsessed.
canonical fields for all platforms:
cpusβ count of CPUs/cores/execution unitsspeedβ clock speed of processor(s) in Mhzmemoryβ installed RAM (in MB)vendorβ manufacturer
::nettool::find_port startingportβ returns startingport if it's available, or the next free port after startingport.
β οΈ heads up bestie: unlike ::nettool::allocate_port, this command does not claim the port. it just looks. π
it uses a built-in database of known ports to avoid returning a port which is in common use. (for example: http (80))
::nettool::hwid_listβ returns a list of hardware specific identifiers from this computer. the source and content will vary by platform, literally:- for MacOSX, you get the motherboard serial number and macids for all network devices.
- for Windows, you get the volume serial number of C and macids for all network devices.
- for Linux, you get macids for all network devices.
::nettool::ip_listβ returns a list of IP addresses associated with this computer. π::nettool::mac_listβ returns a list of MACIDs for the network cards attached to this machine. the MACID of the primary network card comes back first. main character card energy π::nettool::network_listβ returns a list of networks associated with this computer. networks are formated withip::nativeToPrefix.::nettool::port_busy portβ returns true if port is claimed, false otherwise. simple as that. β¨::nettool::release_port port ?protocol?β marks port as not busy, optionally as eithertcp(default) orudp.::nettool::statusβ returns a key/value list describing the status of the computer. the output is designed to be comparable to the output oftopfor all platforms. π
common fields include:
loadβ processes per processing unitmemory_totalβ total physical RAM (MB)memory_freeβ total physical RAM unused (MB)
::nettool::user_data_root appnameβ returns a fully qualified path to a folder where appname should store it's data.
π important: the path is not created, only computed, by this command. so don't come for me when the folder isn't there, okay?
π BUGS, IDEAS, FEEDBACK π
this document, and the package it describes, will undoubtedly contain bugs and other problems. π please report such in the category odie of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. please also report any ideas for enhancements you may have for either package and/or documentation. we want them fr fr.
when proposing code changes, please provide unified diffs, i.e the output of diff -u.
note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. π«Ά
π KEYWORDS π
nettool, odie
β CATEGORY β
System
π COPYRIGHT π
Copyright (c) 2015-2018 Sean Woods <yoda@etoyoc.com>
and that's the whole page, bestie π this was nettool, section 3tcl, shipped out of tcllib at version 0.5.4. go forth and network responsibly π¦πΈ
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2015-2018 Sean Woods <yoda@etoyoc\&.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms