nettool(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 either tcp (that's the default) or udp.
  • ::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/cpuinfo and /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 units
  • speed β€” clock speed of processor(s) in Mhz
  • memory β€” 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 with ip::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 either tcp (default) or udp.
  • ::nettool::status β€” returns a key/value list describing the status of the computer. the output is designed to be comparable to the output of top for all platforms. πŸ“Š

common fields include:

  • load β€” processes per processing unit
  • memory_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 (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