How to make libsmblient only open one connection per server


April 2010.
Windows XP only accept 10 smb connections. When you parse a computer, you will only be able to open 10 shares, since samba doesn't close them at the right time.

Solution, initiate the library and modify the right parameter.


err = smbc_init(auth_fn, 1);
SMBCCTX *hContext = smbc_set_context(NULL);

//Choose the working one between:
smbc_setOptionOneSharePerServer(hContext, 1);
//And
hContext->options.one_share_per_server = 1;