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)




"Awesome response, as usual. It is a sincere and refreshing pleasure to do business with DTN, compared to your competition." - Comment from Ryan
"Thanks for following up with me. You guys do a great job in tech support." - Comment from Phelps
"IQFeed version 4 is a real screamer compared to anything else I have seen." - Comment from Tom
"I cannot believe what a difference it makes trading with ProphetX!" - Comment from Bruce in Los Angeles
"DTN has never given me problems. It is incredibly stable. In fact I've occasionally lost the data feed from Interactive Brokers, but still been able to trade because I'm getting good data from DTN." - Comment from Leighton
"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
"Thanks for the great product and support. During this week of high volume trading, my QuoteTracker + IQ Feed setup never missed a beat. Also, thanks for your swiftness in responding to data issues. I was on ******* for a few years before I made the switch over early this year, and wish I had done it a long time ago." - Comment from Ken
"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
"I was on the phone with a friend who uses CQG and right after the Fed announcement, CQG was as much as 30 seconds behind DTN.IQ. Some quotes were off by as much as 15-18 cents. Your feed never missed a beat." - Comment from Roger
"Version 4.0.0.2 has been working well for me and I appreciate that it is now a much tighter client to work with. I feel I can go to press with my own application and rely on a stable platform" - Comment from David in IA.
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: Sat May 18, 2024 9:00 AM CFBB v1.2.0 11 ms.
© AderSoftware 2002-2003