Network communication design based on Net-BIOS protocol

1 Introduction

In the computer network system where all file servers exist, to realize communication or information exchange between PCs, generally one workstation writes information to the file server and then another workstation reads it. This is the information between the workstations A way to exchange, but not the best and most convenient way. Because the file server is used, it is slow, takes up space on the hard disk, and requires frequent maintenance and management of the file system. Moreover, the user's access right to the file system is also limited by factors such as authority, and more importantly, the existence of the server, which increases the cost and cost of the network system. Therefore, in many cases, direct communication between PCs supported by Net-BIOS is simpler and more economical.

2 Data communication and NetBIOS protocol

Data communication usually contains the following items:

One is the establishment and removal of connections. That is, in the computer network communication, in order to make the source host communicate with the target host

Letter, usually establish a connection between them before communication, that is, establish a communication line from the source host to the target host, and remove the established connection at the end of the communication.

The second is data transmission control. That is, after the communication parties establish a connection, the connection is used to transmit the number of users

according to. There is also error detection and handling.

NetBIOS (NETWORK BASICINPUT / OUTPUTSYSTEM) network basic input / output system is a special program used for communication between computers and one of the important protocols in computer network communication. It supports protocols such as TCP / IP, MAP / TOP, IEEE, and OSI, and NetBIOS is rapidly becoming a programming platform commonly used in different operating system environments. The basic concepts of NetBIOS include NetBIOS names, NetBIOS commands, NetBIOS communication methods, etc., which are explained below.

NetBIOS name: NetBIOS is a system that works by name, and each network workstation has a name. NetBIOS keeps a list of names. Each name consists of 16 characters. When communicating, the source and destination addresses of the information are represented by names.

NetBIOS command: The function of NetBIOS is completed by a series of commands. There are two WAIT and NO_WAIT return modes for NetBIOS commands. The former waits until the command is completed before returning to your program, the latter immediately returns to your program, and brings back the "immediate return code", and returns a "final return code" when the command is completed.

NetBIOS communication method: NetBIOS has two communication methods, namely datagram communication method and session communication method. Datagram communication is a non-connection-oriented communication method. The length of information in each datagram must be less than or equal to 512 bytes. Session communication is a connection-oriented communication method. The length of information is limited to 65535 bytes. .

3 Design of network communication system supported by NetBIOS

3.1 Correct choice of communication method

We know that NetBIOS has two communication methods, namely datagram communication method and session communication method. So, what kind of communication method is used in the design of the communication system? This should be analyzed according to our actual situation.

As datagram communication, each message is treated as an independent datagram, that is, each datagram is independent of each other and transmitted separately without establishing and tearing down the session connection, so it is simple and convenient, and the communication speed is fast. However, this mechanism does not detect whether the information reaches the destination safely during the communication process. When there is an error in the system, there is no error message, and the length of each datagram message is limited by 512 bytes. Therefore, datagram communication is only suitable for The information sent is a series of unrelated messages and some simple conversations and small data occasions.

The session communication method is to establish a session connection between the sender and the receiver before the communication, and then carry out the session communication. During the session communication, all the messages sent can be sent to the destination without error. If more than one message is sent, the communication protocol will ensure that the order of received messages is the same as the order of sent messages. If an error occurs during the transmission of the message, the communication protocol will automatically resend it, correct it, and prompt with an error message. Finally, disconnect the session connection after sending the message.

It can be seen that the session communication process is more complicated, the communication speed is slower, and the length of information in the communication is limited to 65535 bytes. Therefore, the session communication is suitable for point-to-point multiple reciprocating dialogues and large data occasions.

Datagram communication methods and session communication methods each have advantages and disadvantages. The datagram method is suitable for transmitting data in small batches, the reliability is not high, and errors or losses are prone to occur during data transmission, but its transmission process is relatively simple, easy to implement, and easy to manage. The amount of information that can be transmitted in the conversation mode is large and the reliability is high, but the transmission process is relatively complicated. A conversation connection must be established before the information is sent, and the conversation connection must be removed after the information transmission is completed, which is not easy to manage. When we design the communication system in detail, we should choose the appropriate communication method according to our actual situation, actual requirements and the size of the actual amount of data transferred. If the communication between workstation A and workstation B is in the form of data messages, the steps are as follows:

Workstation A Workstation B

a Add name A Add name B

b Send message to B to receive

c Receive and send packets to A

d delete name A delete name B

If the communication between workstation A and workstation B is in conversation, the steps are as follows:

Workstation A Workstation B

a Add name A Add name B

bListen Call A station

c Send message to B Receive message

d Receive message and send message to A

eHang up B stationHang up A station

f delete name A delete name B

3.2 Correct choice of NetBIOS command return method

There are two ways to return NetBIOS commands: WAIT (waiting) and NO_WAIT (non-waiting). If the WAIT method is used, wait until the NetBIOS command is completed before returning to your program. If the NO_WAIT method is used, then there are two options: one is to use the polling method, that is, to repeatedly query the final return code field in the network control block (NCB). When its value changes from FF to 00, it means NetBIOS The command completes and returns to the user program. The other is to tell NetBIOS the address of a POST program so that NetBIOS wakes up the program when the command is completed and executes a specified program segment. These two methods are carried out in the background, and their main difference lies in the impact on the network load. For example, station A issues a command requesting station B to perform a more time-consuming task. If station A uses the NO_WAIT polling method and continuously asks the other party whether it has completed the task, this will greatly increase the network load. Relatively easy to program, that is not a good choice. When we design the communication system, we must integrate various factors and select the appropriate NetBIOS command return method.

Universal Series Extension Sockets

Socket Extension,Trailing Socket,Plug Socket Extension,Single Socket Extension Lead

Heikki Technology Co., Ltd. , https://www.heikkipower.com