Connection Establishment

After the server name has been resolved to an IP address, then a connection to the server needs to be established if one has not already been set up. Connection establishment is done using the Call primitive of the NETBIOS session service, which requires the client to provide a "calling name" and a "called name". The calling name is not significant in CIFS, except that an identical name from the same transport address is assumed to represent the same client; the called name is always "*SMBSERVER ". Over TCP, the Call primitive results in a "Session Request" packet to port 139 (see section 4.3.2 of RFC 1002).

Backwards compatability

If a CIFS client wishes to interoperate with older SMB servers, then if the Call is rejected by the server, it can retry with a new called name. The choice of the new called name depends on the name resolution mechanism used. If DNS was used, the called name should be constructed from the first component of the server's DNS name, truncated to 15 characters if necessary, and then padded to 16 characters with blank (20 hex) characters. If NETBIOS was used, then the called named is just the NETBIOS name. If these fail, then a NETBIOS "Adapter Status" request may be made to obtain the server's NETBIOS name, and the connection establishment retried with that as the called name.