NetBIOS Name Service class

I’ve just posted my NetBIOS Name Service class on fezzer.

Stop pinging and connecting to your FEZ’s IP addres and start using a real network name :wink:

All I’m asking is to credit my work if you’re using it in your project.

Awesome, thanks for the post!

Can you please amend your code whit a license? Apache 2 is ideal if you do not mind.

@ Gus: Done

Sweet! This is going right onto my fez …

So this will work with anything on the PC?

I am assuming browsers too?

What about using a specific port? Can I use this in a browser for port 123?

You could also just use IP’s “…/etc/hosts” file (and/or dns or Wins server) and not have another network stack running on the fez.

Sample contents

\windows\system32\drivers\etc\hosts MyFez1 MyOtherFez localhost

Not ideal. Let us say someone makes a product with FEZ and that product is networked connected. Now you can get toe the product by knowing the IP address but then how sweet it would be if you can just use the name.

With DHCP, you do not know the IP easily.

You can if you are also using WINS server on the network. The DHCP lease can instruct the dhcp client to register with WINS. DNS server can then query the WINS server - a form of dynamic dns. So you can query client names from netbios or dns clients. Naturally more useful if IP device count starts getting over some number (i.e. >~5).

1 Like


Wouter, your code works like a charm with my FEZ Spider!

I have a question for you. I’m developing a library for FEZ Spider and .NET Gadgeteer, called .NET Gadgeteer Toolkit. This library is open source, with Apache 2.0 license, and will be released on CodePlex, At this moment, the project isn’t published yet, but I think it will be online during the next week. So, I would like to know if I can add your Name Service class in the library, obviously with the credit to you for this portion of code.

What do you think about this idea?

Thanks in advance for the attention.

@ Marco: as long as you credit me and add the hyperlink to the original page on, I’m fine with that!


Thanks again for your support!

@ Wouter This is excellent code!

I would like all my FEZs to appear in their own Windows Group. Can I use this service to add a new Group name as well as a new Host name to a Windows network?


It should be possible by playing with the NameType and MsSuffix flags. I never tried it.

You can see MsSuffix and NameType from your own Windows device with this method:

  1. run > “cmd”
  2. “ipconfig” (write down your own IP)
  3. "nbtstat -a "

You should get a list of all names registered on your device.

Thanks @ Wouter. I’ll give it a try when I get home tonight.

@ Wouter
I added two unique names and one group name to the FEZ Cobra (see image).
This image also shows the groups on my local computer.
However, the FEZ Cobra still does not show up in the My Network Places under HOMEGROUP.

There might be some additional broadcast methods the code needs to respond too. I’ll have to check that. I’ll be back 8)

Thanks @ Wouter.
I thought that might be the case, and I was going to read the RFC some more, but I was too tired last night :slight_smile:

I also noticed that one PC on my LAN had a group called “–_MSBROWSE” with a Suffix of 0x01. That must be the master browser, correct?

I tried a lot, even used workarounds detailed here: [url]

But didn’t get the FEZ appear in the network list of windows. I think windows is checking some other protocols before deciding to show a device in that list…

I welcome everyone that can help a hand here :slight_smile:

I have uploaded modified source code to

Note that I also have changed the licensing from Apache 2.0 to GNU 3.

I was experimenting with this setup:

nameService = new NameService();
nameService.AddName("FEZCOBRA", NameService.NameType.Unique, NameService.MsSuffix.Default);
nameService.AddName("FEZCOBRA", NameService.NameType.Unique, NameService.MsSuffix.FileServerService);
nameService.AddName("HOME", NameService.NameType.Group, NameService.MsSuffix.Default);
nameService.AddName("HOME", NameService.NameType.Group, NameService.MsSuffix.MasterBrowserUnique);
nameService.AddName("HOME", NameService.NameType.Group, NameService.MsSuffix.BrowserServiceElections);

I tried a similar setup with these name requests:

nameService.AddName("HOMEGROUP", NameService.NameType.Group, NameService.MsSuffix.Default);
nameService.AddName("FEZCOBRA", NameService.NameType.Unique, NameService.MsSuffix.Default);
nameService.AddName("FEZCOBRA", NameService.NameType.Unique, NameService.MsSuffix.FileServerService);

I ran this utility nbtscan.exe found at [url][/url], and got these results:

C:\Documents and Settings\Jim>nbtscan -f HOMEGROUP\OFFICEPC SHARING
OFFICEPC <00> UNIQUE Workstation Service
OFFICEPC <20> UNIQUE File Server Service
HOMEGROUP <00> GROUP Domain Name
00:30:1b:bc:ce:25 ETHER OfficePC.home HOMEGROUP\HNSERVER1 SHARING
HNSERVER1 <00> UNIQUE Workstation Service
HOMEGROUP <00> GROUP Domain Name
HNSERVER1 <20> UNIQUE File Server Service
HOMEGROUP <1e> GROUP Browser Service Elections
HOMEGROUP <1d> UNIQUE Master Browser
MSBROWSE.<01> GROUP Master Browser
70:71:bc:9a:90:66 ETHER HNServer1.home HOMEGROUP\NETBOOKPC SHARING
NETBOOKPC <00> UNIQUE Workstation Service
HOMEGROUP <00> GROUP Domain Name
NETBOOKPC <20> UNIQUE File Server Service
HOMEGROUP <1e> GROUP Browser Service Elections
00:1e:64:20:83:72 ETHER NetbookPC.home HOMEGROUP\FEZCOBRA SHARING
HOMEGROUP <00> GROUP Domain Name
FEZCOBRA <00> UNIQUE Workstation Service
FEZCOBRA <20> UNIQUE File Server Service
00:1a:f1:00:42:0d ETHER HOMEGROUP

Notice that this utility thinks the FEZCOBRA is in HOMEGROUP, and also the name registrations for FEZCOBRA look very similar to the registrations by OFFICEPC (the computer I’m using right now).

Based on this, I agree with you that the configuration is correct, but that there is either some other NetBIOS message that needs to be handled, or that Windows computers are running some other protocol that enables the computers to show up in My Network Places.

RFC 1001 defines this Name Query process:


Name query is generally, but not necessarily, a prelude to NetBIOS
session establishment or NetBIOS datagram transmission. However,
name query may be used for other purposes.

A B node may elect to build a group membership list for subsequent
use (e.g. for session establishment) by collecting and saving the

And also this group membership process:


The entire membership of a group may be acquired by sending a NAME
QUERY REQUEST to the NBNS. The NBNS will respond with a POSITIVE
response completes the procedure and indicates that there are no
members in the group.

If the positive response has the truncation bit clear, then the
response contains the entire list of group members. If the
truncation bit is set, then this entire procedure must be repeated,
but using TCP as a foundation rather than UDP.