Could it be WINS or some Microsoft proprietary stuff?

Ok, I've researched a bit more: this is done via NetBIOS. If you check out this answer it'll use nmblookup __SAMBA__, which is something you can also do on macOS via smbutil view //__SAMBA__.

So you may need to find a NetBIOS library to do the lookup from within your app.


Edit: Further investigation shows that it's indeed the WINS protocol that's used here. nmblookup performs an UDP broadcast, which I've captured with Wireshark (in this case via nmblookup WORKGROUP, which in my setup returns the same information as nmblookup "*"):

The answers come in one after the other and their UDP packets contain the IP-Addressed in their last for bytes:

I've tried creating an example Python script that opens an UDP socket and sends the request, but receiving turned out to be a bit more difficult.


Another update: I've found a UDP broadcast example and adapted it a WINS request: GitHub Gist.

Basically you create a socket via socket(), enable broadcasts via setsockopt() and then you send the packet via sendto().

To read the various responses, use select() and recvfrom() multiple times. Provide a reasonable timeout to not wait indefinitely, in case no further responses have been received.

Sockets are weird API for sure.

Answer from Karsten on Stack Overflow
🌐
Reddit
reddit.com › r/sysadmin › mac os smb browsing performance
r/sysadmin on Reddit: Mac OS SMB browsing performance
July 11, 2014 -

So here's a weird problem I'm trying to diagnose, and I wonder if anyone out there has any ideas on how to proceed. I work in an environment where we use Microsoft DFS servers for file sharing, and they're pretty straightforward configurations that hundreds of Windows users have mounted as drive letters for both personal and departmental file sharing. No performance issues for them.

However, we're starting to bring on board more Mac OS X users who are mounting these shares in Finder and having performance problems. Transfer times up and down are reasonable, but simply opening a folder to view its contents takes 30-300 seconds to display files. This is the same whether we use Finder directly or pop open an terminal window and ls the contents in /Volumes/driveshare. Most users assume their shares are empty because it takes so long to view what's in them (and this is the same whether there are 20 files in a folder or 2000.)

These users are all running Mac OS X 10.9.2+, and while the performance is worse off campus through VPN, even on campus over fast Ethernet / wired connections the browse times are consistently ridiculous.

We've contacted Apple professional services, who basically said 'meh' and suggested we try Dave from Thursby software. This product replaces the SMB stack in Mac OS X, and it improved performance almost not at all. We've tried mounting shares using CIFS path names instead of SMB, and that doesn't really change anything.

Packet captures show a lot of file listings going on while this browsing is happening, and very often there will be a lot of host not found or path not found errors returned. Despite those errors browsing always produces a view of the directory eventually. Both DNS and WINS servers are in place and the Macs are using them.

Any thoughts on other ways to investigate this issue or variables to tweak?

🌐
Apple Support
support.apple.com › en-us › 102064
Adjust SMB browsing behavior in macOS - Apple Support
February 29, 2024 - To speed up SMB file browsing, you can prevent macOS from reading .DS_Store files on SMB shares. This makes the Finder use only basic information to immediately display each folder's contents in alphanumeric order.
🌐
GitHub
github.com › kishikawakatsumi › SMBClient
GitHub - kishikawakatsumi/SMBClient: Swift SMB client library and iOS/macOS file browser applications. · GitHub
Swift SMB client library and iOS/macOS file browser applications. This library provides a high-level interface to the SMB protocol and allows you to access files on remote SMB servers.
Starred by 278 users
Forked by 41 users
Languages   Swift
🌐
Montana
ag.montana.edu › it › support › smb-macs.html
Connecting to SMB shares with Mac OS X - College of Agriculture IT | Montana State University
In the Server Address field, enter smb:// to define the network protocol for SMB, and then enter either the IP address or the hostname of the server.
🌐
Qumulo Care
care.qumulo.com › hc › en-us › articles › 360000515867-Faster-SMB-Browsing-with-Mac-OS-X-10-13-or-later
Faster SMB Browsing with Mac OS X 10.13 or later – Qumulo Care
April 27, 2022 - With the release of High Sierra, Apple introduced enhancements to significantly speed up browsing times on network folders over SMB protocol. Users can now prevent Mac OS X from comparing directories against the .DS_Store file, which introduced latencies based on the number of files within the directory, and enable Finder to only use basic information to display the folder's contents in alphanumeric order.
Top answer
1 of 3
4

Could it be WINS or some Microsoft proprietary stuff?

Ok, I've researched a bit more: this is done via NetBIOS. If you check out this answer it'll use nmblookup __SAMBA__, which is something you can also do on macOS via smbutil view //__SAMBA__.

So you may need to find a NetBIOS library to do the lookup from within your app.


Edit: Further investigation shows that it's indeed the WINS protocol that's used here. nmblookup performs an UDP broadcast, which I've captured with Wireshark (in this case via nmblookup WORKGROUP, which in my setup returns the same information as nmblookup "*"):

The answers come in one after the other and their UDP packets contain the IP-Addressed in their last for bytes:

I've tried creating an example Python script that opens an UDP socket and sends the request, but receiving turned out to be a bit more difficult.


Another update: I've found a UDP broadcast example and adapted it a WINS request: GitHub Gist.

Basically you create a socket via socket(), enable broadcasts via setsockopt() and then you send the packet via sendto().

To read the various responses, use select() and recvfrom() multiple times. Provide a reasonable timeout to not wait indefinitely, in case no further responses have been received.

Sockets are weird API for sure.

2 of 3
2

The way I would approach it would be to do an IP scan looking for IPs that report an mDNS or SMB name/capability.

Some googling later, it seems that the most suitable command is: dns-sd -B _smb

I don't know if this is what apps like LanScan use to do it, but it might give you enough to go on. There seems to be the start of a code trail that could be relevant at: https://apple.stackexchange.com/a/65679/15281

🌐
Centralit-helpdesk
centralit-helpdesk.co.uk › index.php
Adjust SMB Behaviour in macOS 10.13 and later - CIT (UK)
But you can make adjustments to optimize SMB browsing in enterprise environments. This article is intended for enterprise and education system administrators. Your Mac determines how each window and its contents should appear by collecting file information such as labels, tags, and other forms ...
🌐
GitHub
github.com › orgs › community › discussions › 164959
MacOS Slow browser folders/files on SMB Sharing · community · Discussion #164959
July 3, 2025 - You're not alone @auto-dgrp slow navigation of Samba shares on macOS (especially when browsing directories) is a common issue. Windows and Linux clients typically perform well, but macOS can struggle due to how it handles SMB (Samba) protocols and metadata.
🌐
Reddit
reddit.com › r/sysadmin › access smb:// paths (mac) in win11 file explorer
r/sysadmin on Reddit: Access smb:// paths (Mac) in Win11 File Explorer
March 30, 2023 -

Hello,

My business is a hybrid Mac-Windows environment. To access our SMB shares, Mac users use a server path smb:\\nameofserver, while Windows users use a letter drive (P:\, M:\, etc), or a UNC path (\\nameofserver). Is it possible for Windows file explorer to correctly navigate to a smb:\\ path without any translation? It would make file sharing between OS's much more seamless. Please let me know if anyone has found a solution, thanks!

Find elsewhere
🌐
GitHub
github.com › acproject › SMBClient_example
GitHub - acproject/SMBClient_example: Swift SMB client library and iOS/macOS file browser applications. · GitHub
Swift SMB client library and iOS/macOS file browser applications. This library provides a high-level interface to the SMB protocol and allows you to access files on remote SMB servers.
Author   acproject
🌐
FileBrowser
stratospherix.com › products › filebrowser-mac
Cloud Storage Manager for Mac - FileBrowser Pro
FileBrowser Pro for Mac also features integrated SMB, FTP and WebDAV clients allowing you to seamlessly connect to other machines on your network.
Rating: 4.5 ​ - ​ 641 votes
🌐
Macworld
macworld.com › home › apple › news
SMB Made Easy | Macworld
March 7, 2005 - How many users remember that they have to type smb://workgroup;serveraddress/share/ ? (If you click the Browse button, you may be able to see the desired Windows share, but only if it’s on the same network subnet and assigned to the same workgroup; and even then it’s not guaranteed thanks to a slightly buggy Network Browser implementation.)
🌐
Samba
samba.org › samba › docs › using_samba › appf.html
Appendix F. Running Samba on Mac OS X Server
With options under the Neighborhood tab, you can configure your machine as a WINS client or server or have it provide browser services locally or across subnets. When you've finished configuring Windows Services, click the Save button, then click the Windows icon in Server Settings, and select Start Windows Services. This starts the Samba daemons, enabling access from SMB clients.
🌐
App Store
apps.apple.com › us › app › smb-manager-cifs-client › id1141340577
SMB Manager - CIFS Client - App Store - Apple
+ You will be able download files through the built-in app browser. This app is the perfect solution for storing, viewing and file management! Extended functionality, high speed and stability of work, elegant design and user friendly navigation by gestures will make this application a great help in everyday tasks. Already thousands of people have joined us! And you could try this excellent SMB manager!
Rating: 2.9 ​ - ​ 16 votes
🌐
Informer
macdownload.informer.com › advice › smb manager 1.5
Smb Manager 1.5 - download for Mac
Download Smb Manager 1.5 - real advice. SMB MenuExtra.
Rating: 4 ​ - ​ 1 votes
🌐
FileBrowser
stratospherix.com › support › interactive-troubleshooter › enable-smb-file-sharing-on-your-mac.php
Enable SMB file sharing on your Mac
August 20, 2024 - Whether you are connecting on a home network, office network, or VPN connection, FileBrowser is designed for fast and secure access to Mac shared folders, SMB shares, and network storage.
🌐
GitHub
github.com › helgeklein › sambee
GitHub - helgeklein/sambee: Browser-based file viewer and manager for SMB shares and local drives, with fast previews and Markdown editing on desktop and mobile. · GitHub
SMB shares are accessed through Sambee's server component, which translates between HTTP(S), which your browser understands, and SMB, which a file server understands. Local drive access is provided by Sambee Companion, a helper app that can be installed on your computer and acts as a small service your browser can talk to. All of this means that Sambee brings your files and folders into the browser and makes them accessible from your phone in much the same way as from your PC or Mac.
Author   helgeklein