Partager via


3.2.4.2.1 Connection Establishment

The client SHOULD search the Client.ConnectionTable and attempt to find an SMB connection where Client.Connection.ServerName matches the application-supplied ServerName. If a connection is found, the client SHOULD use the existing connection.

If there is no existing SMB connection, a new SMB connection MUST be established.

The ServerName and the optional TransportIdentifier provided by the caller are used to establish the connection. The client SHOULD resolve the ServerName as described in [MS-WPO] section 6.1.3 and SHOULD attempt connections to one or more of the returned addresses. The client MAY attempt to initiate the SMB connection on all SMB transports that it supports, most commonly NetBIOS over TCP (NBT, as described in section 2.1.1.2) and the other transports described in section 2.1. The client MAY choose to prioritize the SMB transport order and try each SMB transport sequentially or try to connect on all SMB transports and select one using any implementation-specific heuristic. The client MAY accept the TransportIdentifier parameter from the calling application, which specifies what SMB transport to use, and then attempt to use the transport specified.<198>

If all connection attempts fail, the connection establishment is failed and an appropriate error is returned, which is passed back to the calling application, as described earlier.

If the connect attempt succeeds, the client MUST create a new SMB connection as described in 3.2.1.2 and insert it into the global Client.ConnectionTable. Client.Connection.ServerName MUST be set to the caller-supplied ServerName.