Join the 80,000 other DTN customers who enjoy the fastest, most reliable data available. There is no better value than DTN!

(Move your cursor to this area to pause scrolling)




"I just wanted to tell you what a fine job you have been doing. While *******, from what I hear, has been down and out, off and on, IQ feed has held like a champ this week." - Comment from Shirin
"Everything is working great ! Very impressive client. The news refreshes better and is more pertinent than the ******* feed I paid $ 100/month for. I Also like the charts a lot." - Comment from Leon
"For anyone considering using DTN.IQ for a data feed, my experience with the quality of data and the tech support has been very positive." - Comment from Public Forum
"You have an excellent product !!!!!!" - Comment from Arely
"Can I get another account from you? I am tired of ******* going down so often" - Comment from George
"There is no doubt that IQFeed is the best data provider. I am very satisfied with your services. And IQFeed is the only one that I would recommend to my friends. Now, most of them are using your product in China." - Comment from Zhezhe
"You are either overstaffed or people just don't have problems with your feed because customer support always answers the phone quickly." - Comment from Jay via Email
"I just wanted to let you know how fast and easy I found it to integrate IQFeed into our existing Java code using your JNI client. In my experience, such things almost never go so smoothly - great job!" - Comment from Nate
"I am very pleased with the DTNIQ system for quotes and news." - Comment from Larry
"I've never had DTN go out on me since switching. ******* would go down a couple times every month when I was using them." - Comment from Bryce in AL.
Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »NEW IQFEED FORUMS »Miscellaneous Messages »Kotlin code example
Author Topic: Kotlin code example (1 messages, Page 1 of 1)

DTN_Gary_Stephen
-DTN Guru-
Posts: 394
Joined: Jul 3, 2019


Posted: Sep 21, 2023 08:31 AM          Msg. 1 of 1

class IQFeedSocket : Socket() {
fun start() {
connect(InetSocketAddress("localhost", 9100))
val brBufferedReader = BufferedReader(InputStreamReader(this.inputStream))
val brBufferedWriter = BufferedWriter(OutputStreamWriter(this.outputStream))

// Initialize the protocol, this prepares us for commands to come and verifies that our socket is working as intended.
brBufferedWriter.write("S,SET PROTOCOL,6.2\r\n")
brBufferedWriter.flush()

brBufferedWriter.write("HDX,AAPL,30\r\n")
brBufferedWriter.flush()
thread {
var line: String
while (brBufferedReader.readLine().also { line = it } != null) {
println(line)
}
brBufferedReader.close()
brBufferedWriter.close()
close()
}
}
}


Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist
 

 

Time: Tue April 30, 2024 3:40 AM CFBB v1.2.0 12 ms.
© AderSoftware 2002-2003