phj
asked on
NBTSTAT -a how to program?
Which network function(s) do I have to use if I what to develop a WIN32 program which has the same functionality as NBTSTAT -a <IP-ADDRESSE>?
Check the documentation on the NetWkstaXXX family of functions. These will get you most of the available network services.
ASKER
I have been checking NetWkstaXXX as jhance suggested, but did't find any clue here. I looked at DEJANEWS, where other people have asked the same question, but I did't find any answer here.
The only thing I found was that you have to use gethostbyaddr. I don't have doc for this Winsock function here, but I belive that it will take a given IP-address and in my case use WINS or broadcast to resolve this a hostname.
Perhaps you can use this function together with some NetBIOS calls (fx NCB.STATUS), but still I am not close to a solution.
The only thing I found was that you have to use gethostbyaddr. I don't have doc for this Winsock function here, but I belive that it will take a given IP-address and in my case use WINS or broadcast to resolve this a hostname.
Perhaps you can use this function together with some NetBIOS calls (fx NCB.STATUS), but still I am not close to a solution.
Maybe you could be more specific about what you are looking for. NBTSTAT give a bunch of stuff about hosts and shares. Are you looking to resolve IP addresses to host names?
ASKER
Hi,
Thanks jhance for coming back, this is my first question.
I will try to explane this in some more details.
Exactly what I what to do is to write a program which in a loop looks at all my IP-addresses. Fx NBTSTAT -A 156.136.9.51 will if this a WfW og NT give me the Remote Name table of this PC. I use static IP-addressing so i know in which range the pc's are would be. Also the Computer name (NetBios name) of a given pc is also done in a very strict system.
In this example NBTSTAT -A 156.136.9.51 will give my the following information: IP-address of course, Computer name, User name and MAC addresse. When this program has been running for a while I have a file containg, i hope, 95% off all the IP-addresses in use and there corresponding computer name, user name and MAC-addresse. Whith this file I will be able to update our user administration system which so far only has oneway. (It runs a IBM Mainframe).
Back to the software. I have V-COMM sourcer looked at NBTSTAT and to my surprise it uses the following DLL: WOSCK32, NTDLL, MSVCRT, ADVAPI32, USER32.
In WSOCK32.DLL it uses only function 10 (inet_addr),14 (ntohl) and 1108 (s_perror). None off these are very interresting. So NBTSTAT must do something else.
In a book I have about Windows NT Networkprogramming, there is some examples using the NetBIOS() API, fx NCB.ENUM, NCB.ADAPTER.STATUS, NCB.SESSION.STATUS. If you should use NETBIOS API, why don't NBTSTAT?.
I will reale hope that this will help.
Thanks for this very objectiv view on this problem :-)
Thanks jhance for coming back, this is my first question.
I will try to explane this in some more details.
Exactly what I what to do is to write a program which in a loop looks at all my IP-addresses. Fx NBTSTAT -A 156.136.9.51 will if this a WfW og NT give me the Remote Name table of this PC. I use static IP-addressing so i know in which range the pc's are would be. Also the Computer name (NetBios name) of a given pc is also done in a very strict system.
In this example NBTSTAT -A 156.136.9.51 will give my the following information: IP-address of course, Computer name, User name and MAC addresse. When this program has been running for a while I have a file containg, i hope, 95% off all the IP-addresses in use and there corresponding computer name, user name and MAC-addresse. Whith this file I will be able to update our user administration system which so far only has oneway. (It runs a IBM Mainframe).
Back to the software. I have V-COMM sourcer looked at NBTSTAT and to my surprise it uses the following DLL: WOSCK32, NTDLL, MSVCRT, ADVAPI32, USER32.
In WSOCK32.DLL it uses only function 10 (inet_addr),14 (ntohl) and 1108 (s_perror). None off these are very interresting. So NBTSTAT must do something else.
In a book I have about Windows NT Networkprogramming, there is some examples using the NetBIOS() API, fx NCB.ENUM, NCB.ADAPTER.STATUS, NCB.SESSION.STATUS. If you should use NETBIOS API, why don't NBTSTAT?.
I will reale hope that this will help.
Thanks for this very objectiv view on this problem :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Sorry for the delayed response.
This is much more complex than I thought. So after some thoughts I have concluded that the easyest way is to write a dos program which calls NBTSTAT -A <IP ADDRESS>.
So I rest my case :-)
Sorry for the delayed response.
This is much more complex than I thought. So after some thoughts I have concluded that the easyest way is to write a dos program which calls NBTSTAT -A <IP ADDRESS>.
So I rest my case :-)
ASKER