|
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)
"It’s so nice to be working with real professionals!" - Comment from Len
"I was with ******* for 4 years at $230 a month, this is a huge savings for me, GOD BLESS YOU PEOPLE," - Comment from T.S. via Email
"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
"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've been using IQFeed 4 in a multi-threaded situation for the last week or two on 2600 symbols or so with 100 simultaneous daily charts, and I have had 100% responsiveness." - Comment from Scott
"Everything is working great with the API. I love it." - Comment from Calvin
"I've been using Neoticker RT with IQFeed for two months, and I'm very happy with both of the products (I've had IQFeed for two years with very few complaints). The service from both companies is exceptional." - Comment from Public Forum
"I am enjoying the feed very much - so superior to the broker provided feed I was previously using." - Comment from George
"I use IQ Feed, Great stuff as far as data analysis information, storage and retrieval is concerned." - Comment from Public Forum
"Interactive Brokers tick data was inconsistent, so I have switched to using DTN exclusively. It is great to no longer have to worry about my datafeed all day long." - Comment from Philippe
|
|
|
|
fng
-Interested User-
Posts: 31
Joined: Aug 2, 2007
|
Posted: Jun 28, 2010 08:51 AM
Msg. 1 of 3
I am running a program where I use some of the code you have in your demo program.
I have the program to close down and restart if I do not get any data in 30 sec.
When the close happens this is the code that is executed correctly:
Private Sub Level1Socket_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Try RemoveClientApp(Me.Handle.ToInt32) FileLog("DTNIQ Close Event - Correct Close Down!") Catch ex As Exception FileLog("CATCH Error in DTNIQ Close Down! " & ex.Message) End Try End Sub According to my log this works fine.
BUT - sometimes when I try to restart the program I get this error from the Onconnect sub:
"No connection could be made because the target machine actively refused it 127.0.0.1:5009"
THIS IS the ONCONNECT SUB:
Public Sub OnConnect() Try m_sockIQConnect = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Dim ipLocalhost As IPAddress = IPAddress.Parse("127.0.0.1") Dim iPort As Integer = GetLevel1Port() Dim ipendLocalhost As Net.IPEndPoint = New IPEndPoint(ipLocalhost, iPort) m_sockIQConnect.Connect(ipendLocalhost)
WaitForData() 'If everything OK then start Timer '---------------------------------------------------------------- btnWatch.Enabled = True btnWatch.PerformClick() FileLog("Onconnect OK - Watch and Timer Start") Timer1.Start() '-------------------------------------------------------------- Catch ex As Exception FileLog("Error from OnConnect: " & ex.Message) Me.Close() End Try End Sub
To me it looks like the RemoveClientApp sometimes does not close the connection, any suggestions please! Catch ex As Exception FileLog("CATCH Error in DTNIQ Close Down! " & ex.Message) End Try End Sub According to my log this works fine.
BUT - sometimes when I try to restart the program I get this error from the Onconnect sub:
"No connection could be made because the target machine actively refused it 127.0.0.1:5009"
THIS IS the ONCONNECT SUB:
Public Sub OnConnect() Try m_sockIQConnect = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Dim ipLocalhost As IPAddress = IPAddress.Parse("127.0.0.1") Dim iPort As Integer = GetLevel1Port() Dim ipendLocalhost As Net.IPEndPoint = New IPEndPoint(ipLocalhost, iPort) m_sockIQConnect.Connect(ipendLocalhost)
WaitForData() 'If everything OK then start Timer '---------------------------------------------------------------- btnWatch.Enabled = True btnWatch.PerformClick() FileLog("Onconnect OK - Watch and Timer Start")
Example from My LOG: 8:55:49 AM DTNIQ Close Event - Correct Close Down! 8:57:18 AM Error from OnConnect: No connection could be made because the target machine actively refused it 127.0.0.1:5009 8:57:18 AM DTNIQ Close Event - Correct Close Down! 8:57:33 AM Error from OnConnect: No connection could be made because the target machine actively refused it 127.0.0.1:5009
FNG
|
DTN_Steve_S
-DTN Guru-
Posts: 2093
Joined: Nov 21, 2005
|
Posted: Jun 28, 2010 10:39 AM
Msg. 2 of 3
FNG, the RemoveClientApp call doesn't actually shut down the feed. The only way to close the app is to either right-click the notification area icon and choose "Exit" from the menu or to disconnect all level 1 connections. IQConnect should exit automatically once there are no longer any connections to the level 1 port.
Also, I don't see anything in your code that actually launches the feed. If your app shuts down and IQConnect closes (as expected), then when you relaunch your app, there is nothing to connect to since IQConnect is no longer running which would cause the error message you are getting.
|
fng
-Interested User-
Posts: 31
Joined: Aug 2, 2007
|
Posted: Jun 28, 2010 12:34 PM
Msg. 3 of 3
Hi -thanks for your answer. When the program loads it connect to DTN - Part of the code:
Dim sRes As Short = 1 'Dim dtn_port As Integer Try
sRes = RegisterClientApp(Me.Handle.ToInt32, strProdID, strProdKey, strProdVersion) If sRes <> 0 Then FileLog("NO LogON - Close") Me.Close() ' Restart from scheduler End If
' ************************************* INIT Files *******************************************
'********************************************* Start Connection og Watch ********************************************************* dtn_port = GetLevel1Port() OnConnect() Catch ex As Exception FileLog("Error Load IQConnect " & dtn_port) Me.Close() End Try End Sub
I think it must have something to do with a thread which is still running when I try to close the program down. Does that sound correct?
Flemming
|
|
|
|