fxcm / ForexConnectAPI

Designed to trade, retrieve live/history price. Intended to be used to build auto-trading robots, custom trading on FXCM accounts.
132 stars 47 forks source link

Login error: Can't connect to server http://www.fxcorporate.com/Hosts.jsp #14

Closed jjqqkk closed 1 year ago

jjqqkk commented 1 year ago

I am using the FC SDK v1.6.5 C++ version to write my program. It's running well on macOS with the default toolchain, every feature has been tested and passed.

$ clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.3.0

However, the same code fails to login on a Debian-9 box, kernel 4.9.0-15-amd64. I've tested with both GCC12 and Clang14.

# gcc --version
gcc (Debian 12.2.0-14) 12.2.0

# clang --version
Debian clang version 14.0.6

After inspecting my own code, I gave it a test with the sample code under the directory /opt/ForexConnectAPI-1.6.5-Linux-x86_64/samples/cpp/.

None of the sample code can perform login successfully. And the error messages are same:

status::connecting
Login error: Can't connect to server http://www.fxcorporate.com/Hosts.jsp.
status::disconnected

I have checked firewall, also curl the URL directly, i am sure the HTTP request can be sent to the server.

And the same machine is running FXCM Rest API client without any problem.

Could you give me any tip on how to debug such issue?

Thanks.

jjqqkk commented 1 year ago

The Java sample code works nicely:

/opt/ForexConnectAPI-1.6.5-Linux-x86_64/samples/java/NonTableManagerSamples/Login

So the problem: C++ sample code cannot connect to server, while Java is OK.

fxcm-dhalpert commented 1 year ago

try with https, test the connection with telnet from command line: telnet fxcorporate.com 443 I tested same Linux version on Ubuntu 17.1 and it works ok.

jjqqkk commented 1 year ago

try with https, test the connection with telnet from command line: telnet fxcorporate.com 443 I tested same Linux version on Ubuntu 17.1 and it works ok.

Thanks. Tried again with HTTPS, same error. Switched to the v1.6.4 SDK, both C++ and Java sample code work nicely.

Anything I can do to troubleshoot this error?

jjqqkk commented 1 year ago

I have fixed the problem by removing the v1.6.4 shared library path from /etc/ld.so.conf.d and add the v1.6.5 path:

root@tradebot:/etc/ld.so.conf.d# cat fc.conf
#/opt/ForexConnectAPI-1.6.4-Linux-x86_64/lib
#/opt/ForexConnectAPI-1.6.4-Linux-x86_64/lib/java
/opt/ForexConnectAPI-1.6.5-Linux-x86_64/lib
/opt/ForexConnectAPI-1.6.5-Linux-x86_64/lib/java

Refresh the lib cache with ldconfig, then all C++ sample code run nicely.