|
dxFeed Graal CXX API v9.0.0
|
This page helps to find the cause when the C++ API receives no data or the connection drops, and tells what to check first. The reference tables of the connection errors are in the headers, see See also.
Run the Diagnose command of the Tools. It checks the way to the data step by step and prints a verdict (DATA, PARTIAL DATA, CONNECTED, NO DATA, CANNOT CONNECT, CANNOT RESOLVE):
The verdicts are described in Versions and addresses in the log.
Write the log of the SDK (QD) to a file, before the first endpoint is created:
There is also an overload with a second file for the errors and warnings only: Logging::init(logFile, errFile, logLevel, errFileLevel). The connection lines quoted below are in this log.
The SDK writes a failed connect or a dropped connection to its log, and the C++ API keeps the newest one as a ConnectionError with a Category. The log line, the category and the first check:
| Log line or exception | Category (ConnectionError::Category) | Likely cause | First check |
|---|---|---|---|
| Failed to connect to 127.0.0.1:64064, then java.net.ConnectException: Connection refused: connect (Windows; on Linux Connection refused) | CONNECT_FAILED | Nothing listens on the port; a wrong port or host; a firewall; the server is down | The host and the port in the address; Tools Diagnose prints the result of a TCP connect to each IP |
| Failed to resolve IPs for diagnose-test.invalid, then Failed to connect to diagnose-test.invalid:7300 with java.net.UnknownHostException: diagnose-test.invalid | DNS | The host name does not resolve: a typo, no DNS server, a proxy | The spelling of the host name; resolve it with the system tools (nslookup, ping) |
| Disconnected from 127.0.0.1:64088 because of Connection closed by remote side (java.io.EOFException) | CLOSED_BY_REMOTE | The server closed the connection: it restarted; it rejected the login or the entitlement; a wrong port or protocol; a proxy in the way. The client cannot tell which | The login and the address options; the port and the protocol of the server; the server side logs |
| java.net.SocketException: Connection reset | IO | The peer or a middlebox reset the connection | The network path: a firewall, a proxy, a load balancer |
| heartbeat timeout exceeded: disconnecting (no exception) | HEARTBEAT_TIMEOUT | The remote side sent no data and no heartbeat for 2 minutes by default: a stalled network or server | The network path; the heartbeat timeout can be changed by the address option [heartbeatTimeout=...] |
| java.net.SocketTimeoutException | READ_TIMEOUT | Nothing arrived for the socket read timeout (5 minutes by default). The 2 minutes of the heartbeat timeout are shorter, so on the default settings it usually fires first (not guaranteed) | Same as for the heartbeat timeout |
| javax.net.ssl.SSLException and other handshake errors | TLS | A tls+ address of a port without TLS, or the reverse; a certificate that is not trusted | The TLS flag in the address and the port; the certificate of the server |
| java.util.concurrent.CancellationException | none: not a connection error | A promise was not completed in time (await with a timeout), was cancelled, its thread was interrupted, or the symbol is rejected by the filter of the feed | The promise, not the network: is the endpoint connected, is the symbol allowed |
The exact texts of the JDK can differ between the JDK versions and the systems, search by the exception class. Any other error has the category OTHER: read its message.
A malformed address is not a connection error: DXEndpoint::connect() throws at once and there is no reconnect loop.
To read the error in code, use DXEndpoint::getLastConnectionError(), which returns a std::optional<ConnectionError>, or add a listener with DXEndpoint::addMessageConnectorListener() and read MessageConnectorInfo::lastError. DXEndpoint::getConnectors() gives the state, the current addresses and the last error of each connector. Failed connect attempts do not change the state of the endpoint: it stays CONNECTING between them, so a state listener (DXEndpoint::addStateChangeListener()) does not see them; read the error in the connector listener. A successful connection clears no error: compare the time or the count of the error with those seen before. The full category table is in MessageConnectorInfo.hpp (the page "Connection troubleshooting"). These functions are experimental and may change.
Connected, but no events? Go through the causes from the most frequent:
| Cause | First check |
|---|---|
| Not entitled: depending on the server, it accepts the connection and sends nothing (the state stays CONNECTED, no error), or it closes the connection (CLOSED_BY_REMOTE) | Tools Diagnose prints CONNECTED, NO DATA; check the login of the address and the entitlements with the data provider |
| A wrong endpoint role | DXEndpoint::Role::FEED is the default. ON_DEMAND_FEED is not connected to a data provider until OnDemandService::replay(); LOCAL_HUB has no network connections; PUBLISHER and STREAM_PUBLISHER publish events; in STREAM_FEED DXFeed::getLastEvent() does not work and the promises of the feed complete exceptionally |
| The symbol is not in the endpoint filter or the IPF of the provider | Try a symbol that is known to exist, for example AAPL on demo.dxfeed.com:7300 |
| A wrong symbol form | See the list below |
| A wildcard * subscription | It needs the endpoint property dxfeed.wildcard.enable=true (DXEndpoint::DXFEED_WILDCARD_ENABLE_PROPERTY) and a permission of the provider |
| The symbol does not trade now | A symbol outside of its trading session is silent. Check another symbol that is active |
| The data stops while the connection stays up | Turn on the silence watchdog of the subscription: DXFeedSubscription::setSilenceWatchdog(timeout). It is off by default and reports a warning through ErrorManager when no events arrive for the timeout while the endpoint is CONNECTED |
Symbol forms to check:
Warnings of the library (a suspicious candle symbol, a silent subscription) go to ErrorManager, which writes them to stderr by default. If you do not see them, check that its handler is not replaced or turned off.
What the API does after a lost connection, and what it does not promise.
Reconnect and the subscriptions.
States.
The delay before an attempt.
Several addresses.
Calls.
Not restored and not guaranteed.
Console samples for frequent tasks. They are built with the library (DXFCXX_BUILD_SAMPLES, on by default). With --duration <seconds> a sample stops by itself, and its exit code tells whether it got what it waited for (0) or not (1), so it can be used in a script; without it the sample runs until it is stopped. The commands use the demo feed demo.dxfeed.com:7300.
| Task | Sample | Command |
|---|---|---|
| Connect to a list of addresses, log the state changes and the connection errors | ReconnectSample | ReconnectSample "127.0.0.1:1,demo.dxfeed.com:7300[connectOrder=ordered]" --duration 30 |
| Get the history of candles | CandleSample | CandleSample demo.dxfeed.com:7300 AAPL{=d} 2025-12-01 --duration 10 |
| Build an order book of one source, with the scope of each order | SimpleOrderBookSample | SimpleOrderBookSample AAPL ntv demo.dxfeed.com:7300 --duration 10; scope=aggregate (or composite, regional, order) shows only the orders of that scope |
| Is the market open now, the sessions and the next holidays | ScheduleSample | ScheduleSample schedule.properties sample.ipf.zip IBM (the files are next to the sample) |
| Load instrument profiles and their live updates | IpfLiveSample | IpfLiveSample --duration 30, or a path to an IPF file instead of the service |
In the first command the closed local port 127.0.0.1:1 fails with CONNECT_FAILED, and the connection moves to the next address of the list.