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)




"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
"I am a hedge fund manager here. It’s funny, I have a Bloomberg terminal and a Bridge feed, but I still like having my DTN feed!" - Comment from Feras
"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
"Thanks for all of your help. Great customer service deserves to be recognized which one the reasons I've been a customer of DTN for over 10 years!" - Comment from Stuart
"I use IQ Feed, Great stuff as far as data analysis information, storage and retrieval is concerned." - Comment from Public Forum
"Just a thank you for the very helpful and prompt assistance and services. You provided me with noticeably superior service in my setup compared to a couple of other options I had looked at." - Comment from John
"I cannot believe what a difference it makes trading with ProphetX!" - Comment from Bruce in Los Angeles
"I'm satisfied with IQFeed. It's the most reliable and fastest quote feed I have ever used. Although I'm a resident in China, it's still very fast!" - Comment from Xiaofei
"You are much better than lawyers or the phone company because you answer the phone when I call! I just love your customer service." - Comment from Isreal
"I used to have *******, but they are way more money for the same thing. I have had no probs with data from DTN since switching over." - Comment from Public Forum Post
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 »Archive (2017 and earlier) »IQFeed Developer Support »basic socket question
Author Topic: basic socket question (2 messages, Page 1 of 1)

jpaladin
-Interested User-
Posts: 2
Joined: Jan 30, 2008


Posted: Feb 2, 2008 09:36 AM          Msg. 1 of 2
I am new to sockets, and figuring out this sample application code :

while (true ) {

line = in.readLine();

sout.write(line+"\r\n");
sout.flush();

if (line.trim().equals("x") ) {break;}

}

So, why does in.readLine() block, and what could it possibly be waiting for ?
Setting a break point after in.readLine() it never hits.
I guess socket code blocks by default when you tell it to read, and it is empty ?

I see that "in" is a System.in socket, so I guess it is some kind of global server socket.

When it gets something, it is reflected to the IQFeed socked that I watch for my data, so I would like to know what I might have to deal with while watching the data.

if an "x" arrives my whole feed is going to be shutdown.

So, I would like to better understand this code.

Joe paladin

JDonovan
-Interested User-
Posts: 24
Joined: Feb 11, 2007


Posted: Feb 5, 2008 07:40 AM          Msg. 2 of 2
Windows sockets block by default....it's waiting for data to arrive. You can easilly set the sockets to non-blocking, suggest digging into some socket documentation/reading if you want to go much further.

- Jeff
 

 

Time: Fri May 17, 2024 5:25 PM CFBB v1.2.0 9 ms.
© AderSoftware 2002-2003