Page 1 of 1

Connection timeout expired

Posted: Wed 08 Jul 2015 22:13
by piopio1
Hello,

I have an application that connects to a remote PostgreSQL DB via SecureBridge. The application works perfectly on my local machine but when the exact same application runs on a remote VPS server then I have the following error message: Exception SocketException in module xxxxx.exe at yyyyy Connection timeout expired

In addition, if I try to connect the same application on the VPS server to a PostgreSQL DB on the same VPS machine (local DB) I have the following error message: A connection with the server could not be established

The following are the parameters I use to connect the application to the remote DB

ScSSHChannel.SourcePort=5440
ScSSHChannel.DestPort=5432
ScSSHChannel.DestHost='DestinationHost'
ScSSHChannel.Timeout=10

PgConnection.Server='localhost'
PgConnection.Username='xxxxxxxx'
PgConnection.Password=yyyyy
PgConnection.Database='zzzzzzzz'
PgConnection.Port=5440

ScSSHClient.HostName='Remotehosting.com'
ScSSHClient.Port=7822
ScSSHClient.User='xxxxxxxxx'
ScSSHClient.Password=yyyyyyyy
ScSSHClient.Timeout=10

I tried to set ScSSHChannel.Timeout=100 and ScSSHClient.Timeout=100 but I keep on receiving the same errors.

Any idea on the cause and how to fix it ?

Many thanks
Pio Pio

Re: Connection timeout expired

Posted: Thu 09 Jul 2015 10:23
by azyk
In the described case, SecureBridge may return the 'Connection timeout expired' error when an attempt to connect to SSH server failed. This may be due to that host/port you are using to connect to the SSH server doesn't exist or access denied.

For this same reason you may get the 'Connection could not be established' error when attempting to connect to PostgreSQL.

To solve the issue, make sure that the hosts/ports you are using in the provided code are correct and not blocked by antivirus, firewall, security policy, etc. on the VPS server.

In addition, try to set a corresponding IP address for this host/server in the TScSSHChannel.DestHost, TPgConnection.Server and TScSSHClient.HostName properties instead of the DNS name.