Reputation: 11873
According to this link, NetBIOS is no longer supported starting from Windwos Vista. Sure enough, I can no longer see any NetBIOS name from the network properties.
However, when I am writing codes on my Windows 7, I still encounter NetBIOS names in many places. For example
I am guessing Microsoft still maintains some pieces of it for backward compatibility. I want to understand how Windows 7 going to resolve the NetBIOS name to an IP address. I found this article explaining how the NetBIOS name resolution works but I am afraid this is no longer true in Windows 7. At least there is no WINS server for me.
My last question is how do I do the NetBIOS name resolution programmatically, preferrably in C#. I am okay to use PInvoke.
UDAPTE
Tridus was right. I can use System.Net.Dns.GetHostAddresses("hostname") to resolve NetBIOS name. I used reflector to see what's happening under the hood. It is calling gethostbyname() from ws2_32.dll
Here, it explains the gethostbyname() will do NetBIOS name resolution.
- Check the local host name for a matching name.
- Check the Hosts file for a matching name entry.
- If a DNS server is configured, query it.
- If no match is found, attempt NetBIOS name-resolution.
About the mystery of NetBIOS not supported in this link, I think it just means the API is not supported. People in ServerFault think that NetBIOS is still supported in Windows 7.
Upvotes: 6
Views: 9895
Reputation: 5081
NetBIOS itself as the old protocol might not be supported, but SMB/CIFS still is and that's why \hostname for filesharing and such still works.
As for how to resolve a name, I was able to do this:
System.Net.Dns.GetHostAddresses("hostname")
I'm on a domain so it may be simply appending a DNS suffix and doing a DNS lookup, but it worked for me. Give it a try. :)
Upvotes: 5