Microsoft KB Archive/177314: Difference between revisions
m (Text replacement - ".htm|" to "|") |
m (Text replacement - "&" to "&") |
||
(3 intermediate revisions by the same user not shown) | |||
Line 39: | Line 39: | ||
For additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base: | For additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base: | ||
<blockquote>[[ | <blockquote>[[../119591|Q119591]] How to Obtain Microsoft Support Files from Online Services</blockquote> | ||
Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.<br /> | Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.<br /> | ||
<br /> | <br /> | ||
Line 55: | Line 55: | ||
nbcommon.c - NetBIOS functions common to client and server | nbcommon.c - NetBIOS functions common to client and server | ||
nbcommon.h - common NetBIOS defines and prototypes </pre> | nbcommon.h - common NetBIOS defines and prototypes </pre> | ||
=== Compilation & | === Compilation & Execution === | ||
These files compile into two applications: client.exe and server.exe.<br /> | These files compile into two applications: client.exe and server.exe.<br /> | ||
Line 81: | Line 81: | ||
# The 16th character must be greater than 0x20. These values 0x20 and below are reserved and designate certain this name as a machine name, user name, etc. Consult a NetBIOS reference for the exact use of these reserved values. | # The 16th character must be greater than 0x20. These values 0x20 and below are reserved and designate certain this name as a machine name, user name, etc. Consult a NetBIOS reference for the exact use of these reserved values. | ||
For example, the server is executed on a machine named | For example, the server is executed on a machine named "AJONES1" with this command: | ||
<blockquote>'''server MYSERVER1'''</blockquote> | <blockquote>'''server MYSERVER1'''</blockquote> | ||
Line 87: | Line 87: | ||
<blockquote>'''nbtstat -a AJONES1'''</blockquote> | <blockquote>'''nbtstat -a AJONES1'''</blockquote> | ||
which will display a list of all names registered with the machine including | which will display a list of all names registered with the machine including "MYSERVER1." Please note that nbtstat.exe is a utility that is installed only when the TCP/IP protocol is installed. It is a very useful utility for debugging certain aspects of Netbios programs, and I would highly recommend installing it.<br /> | ||
<br /> | <br /> | ||
Execute the client from a machine named | Execute the client from a machine named "AJONES2" with this command: | ||
<blockquote>'''client MYCLIENT MYSERVER1'''</blockquote> | <blockquote>'''client MYCLIENT MYSERVER1'''</blockquote> |
Latest revision as of 12:30, 21 July 2020
Netbios.exe: NetBIOS Client and Server Sample |
Q177314
The information in this article applies to:
- Microsoft Win32 Software Development Kit (SDK), used with:
- the operating system: Microsoft Windows NT, versions 3.51, 4.0
- Microsoft Windows 95 OEM Service Release, version 2.0
- Microsoft Windows 98
- the operating system: Microsoft Windows 2000
SUMMARY
Netbios.exe is a NetBIOS programming sample that implements an echo server and client. The sample illustrates how a client and server should be written in order to make the application protocol and LAN Adapter (LANA) independent. It also shows how to avoid common mistakes programmers frequently make when writing NetBIOS applications under WIN32.
MORE INFORMATION
The following files are available for download from the Microsoft Download Center:
NetBIOS.exe
For additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.
For a discussion about LANAs see the following article in the Microsoft Knowledge Base:
Q138037 How to Use LANA Numbers in a 32-bit Environment
This file is associated with the NetBIOS echo client/server sample.
There are four source files associated with this application:
client.c - source code for client app server.c - source code for server app nbcommon.c - NetBIOS functions common to client and server nbcommon.h - common NetBIOS defines and prototypes
Compilation & Execution
These files compile into two applications: client.exe and server.exe.
First, compile nbcommon.c into object code. In a DOS prompt, type:
cl /c nbcommon.c
Next, compile the two applications with the following commands:
cl -o client client.c nbcommon.obj netapi32.lib
cl -o server server.c nbcommon.obj netapi32.lib
To run the server:
server SERVER-NAME
SERVER-NAME uniquely identifies the echo service. All clients who want to connect to the server should connect using this name.
To run the client:
client CLIENT-NAME SERVER-NAME
CLIENT-NAME uniquely identifies the client. SERVER-NAME identifies which NetBIOS server the client wishes to connect to. Both of these names are NetBIOS names which are formed as follows:
- Names are no longer than 16 characters long.
- Names are unique. Only one instance of a name can exist in the network at any time.
- The 16th character must be greater than 0x20. These values 0x20 and below are reserved and designate certain this name as a machine name, user name, etc. Consult a NetBIOS reference for the exact use of these reserved values.
For example, the server is executed on a machine named "AJONES1" with this command:
server MYSERVER1
This establishes the server process as MYSERVER1. This name is registered with the machine and can be verified by running:
nbtstat -a AJONES1
which will display a list of all names registered with the machine including "MYSERVER1." Please note that nbtstat.exe is a utility that is installed only when the TCP/IP protocol is installed. It is a very useful utility for debugging certain aspects of Netbios programs, and I would highly recommend installing it.
Execute the client from a machine named "AJONES2" with this command:
client MYCLIENT MYSERVER1
The client will connect to the server, send a string, and read the string back from the server.
Additional query words:
Keywords : kbfile kbnetwork kbAPI kbNetBIOS kbOSWinNT351 kbOSWinNT400 kbOSWin2000 kbSDKPlatform kbOSWin95 kbOSWin98 kbGrpDSNet
Issue type :
Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch
Last Reviewed: December 17, 2000 |