If this happens always, it literally means that the machine exists but that it has no services listening on the specified port, or there is a firewall stopping you.
If it happens occasionally - you used the word "sometimes" - and retrying succeeds, it is likely because the server has a full backlog.
You can try the below code
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(gMailAccount, password);
If the problem continues, then it would be GMail server issue.