NUTSCAN_SCAN_NUT(3)

✨ NUTSCAN_SCAN_NUT(3) ✨

okay so bestie, welcome to the NUT Manual πŸ’– this one is all about nutscan_scan_nut β€” the little function that goes sniffing around the network like "hello?? any NUT services out there?? πŸ₯Ί" and comes back with a whole list of devices.


🌸 NAME 🌸

nutscan_scan_nut β€” scan the network for available NUT services, bestie. that's the whole job. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <nut-scan.h>
#include <unistd.h> /* useconds_t */

nutscan_device_t * nutscan_scan_nut(
        const char * startIP,
        const char * stopIP,
        const char * port,
        useconds_t usec_timeout);

nutscan_device_t * nutscan_scan_ip_range_nut(
        nutscan_ip_range_list_t * irl,
        const char * port,
        useconds_t usec_timeout);

like, two functions, four-ish arguments each, we move. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so nutscan_scan_nut() and nutscan_scan_ip_range_nut() are both out here trying to detect available NUT services and their associated devices. iconic behavior honestly. 🌈

the difference between the two? here's the tea β˜•:

  • nutscan_scan_nut() fires off a NUT request on every IP ranging from startIP to stopIP. startIP is mandatory (you have to give it), and stopIP is optional β€” if stopIP is NULL, then it just scans that one single startIP address. one and done, no cap. ✨
  • nutscan_scan_ip_range_nut() instead walks through several IP address ranges at once, all represented by a nutscan_ip_range_list_t structure. it's giving "i have many ranges and i'm not afraid to use them." πŸ‘‘

those IP arguments? they can be either IPv4 or IPv6 addresses, or even host names. flexible fr fr. 🌸

⚠️ okay super important: you MUST call nutscan_init(3) before using this function. like, do not skip this step bestie, it will not go well for you. 😭

a specific port number can be passed in via port, or you can pass NULL and it'll use the default NUT port. easy. 🫢

and usec_timeout? that's how long it waits β€” up to that many microseconds β€” before it decides an IP address just isn't responding to NUT queries. it's patient but not that patient. πŸ’€


⭐ RETURN VALUE ⭐

nutscan_scan_nut() hands you back a pointer to a nutscan_device_t structure stuffed with all the found devices πŸŽ‰ … or NULL if something went wrong, or if literally no device was found. no devices, no pointer, that's the vibe. πŸ“


πŸ’œ SEE ALSO πŸ’œ

go read these too, they're all part of the same friend group:


and that's the whole page babes πŸ₯° this was brought to you by Network UPS Tools 2.8.5, dated 10/07/2026. go call nutscan_init(3) first, i'm begging you. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from