arth_trader
-Interested User-
Posts: 5
Joined: Apr 16, 2014
|
Posted: May 18, 2016 10:29 AM
Msg. 1 of 3
I am trying to get historical tick data using the Java API (IQFeed version 5.2.1). Here is the code snippet:
String command = "HTX,IBM,5,,testid,\r\n\n"; // String line; C_LookupIQFeed_Socket.brBufferedWriter.write(command); C_LookupIQFeed_Socket.brBufferedWriter.flush();
while ((line = C_LookupIQFeed_Socket.brBufferedReader.readLine()) != null) { logger.debug("HistoryRecord={}", line); }
It prints the output till the last record ("!ENDMSG!,"), but hangs at the readLine() thereafter i.e. the readLine() is never returning null after the last record. I have tested this on the samples provided, same thing happens. Any idea? Is it possible that the server is not sending a new line after the last message. Is there any other way to handle this?
Thanks.
|
DTN_Tim Walter
-DTN Guru-
Posts: 1238
Joined: Apr 25, 2006
|
Posted: May 18, 2016 12:39 PM
Msg. 2 of 3
Once the ENDMSG is received the data for that request has completed (a null is not sent), Just stop reading the socket at that time, at least until you have requested more data, and I think that will alleviate your issue.
Tim
|