If you are connecting from the Windows machine A to the Windows machine B (server with the SQL Server installed), and are getting this error, you have to do the following:
On machine B:
1.) Turn on the Windows service called the "SQL Server Browser" and then start the service
2.) Then In the Windows firewall, enable the incoming port UDP 1434 (in case if the SQL Server Management Studio(SSMS) on machine A is connecting or a program on the machine A is connecting)
3.) Again In the Windows firewall, enable incoming port TCP 1433 (in case there is a telnet connection)
4.) And in the SQL Server Configuration Manager, enable TCP/IP protocol for port 1433.
Want to know more about SQL ? Join this SQL Certification course by Intellipaat.