I have been developing and debugging this situation for a while. I discovered that the original advice didn't work. First; to get more than 2 client connections going, I had to increase the number of file descriptors;
CONFIG_POSIX_MAX_FDS=20
Then I discovered that I wasn't able to add more than 4 client connections. This took some real digging and I got down to the nrf_socket interface but things disappear into the modem at that point. Then I noticed this little tidbit in the nrf_socket documentation;
The library has the following set of sockets:
* 8 generic sockets that can be used freely between UDP, TCP, TLS, DTLS, and AT commands
* 1 GNSS/AGPS socket
* 1 modem DFU socket
* 10 PDN sockets
Which I assume means I'm limited to 8 sockets. I'm guessing this means I can't have more than 8 sockets active at one time. I'm also figuring that some combination of the 4 sockets I'm using for my client connection and other uses are leading me to the errors I'm getting;
[00:24:01.650,085] <err> net_mqtt_sock_tls: Connection Error -1
[00:24:01.651,794] <err> net_mqtt: Error creating transport connection -22
[00:24:01.651,824] <err> gcloud: mqtt_connect failed: -22 Invalid argument
Unfortunately, I can see no way to increase this limit to test the hypothesis further. I was hoping that you could add some insite.