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 »Running IQConnect from a windows service
Author Topic: Running IQConnect from a windows service (18 messages, Page 1 of 1)

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 12, 2011 06:05 AM          Msg. 1 of 18
We've been integrating IQFeeds with our aaplication lately and bumped into a MAJOR problem. Our application works great, when we are running IQConnect from a regular windows session (ie running iqconnect.exe from command console while being logged on to windows under a developer user account). While running iqconnect this way we get a "IQ Connect Login" screen which has all of the information prepopulated, but still requires us to press a Connect button (see the image attached).

This is a command lie we are using (registration info replaced with XXX):
"C:\Program Files\DTN\IQFeed\iqconnect" -product XXX -version 1.0 -login XXX -password XXX -autoconnect

We are running the latest version (4.7.2.0).

It is essential for our system that we can guarantee the IQConnect is running on a server machine without any user interventions. Trying to achieve that we've been running IQConnect both as a scheduler job and starting it from a windows service created as a sort of a watch dog. When started like this, the iqconnect.exe process can be seen from Windows Task Manager, but we can NOT connect to it from our applications.

I'm assuming IQConnect has started but is still waiting in the background (no window or tray icon appearing) for someone to press that Conenct button. Is there a way we can make it so that it autoconnects (the -autoconnect switch does NOT help)?


To reiterate:
- When running iqconnect from interactive windows session everything is fine, except we need to click on Connect button. Other than that we got the feeds going.
- When running it from a non-interactive session we cannot connect to it.

It is critical to resolve this IMMEDIATELY. Please advise.

Thanks,
Djordje



File Attached: iqconnect_logon.jpg (downloaded 1363 times)

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: May 12, 2011 08:58 AM          Msg. 2 of 18
the autoconnect flag is ignored unless you are also saving the login/password.

You will either need to add the savelogin/password flag, or automate the login process by connecting to the admin port of IQFeed

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 12, 2011 10:13 AM          Msg. 3 of 18
Thank you!

Setting both -autoconnect & -savelogininfo seems to have did the trick.

We now seem to have port collisions with another app on our server (port 9100).
How can I change IQConnect's default ports?

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 12, 2011 10:24 AM          Msg. 4 of 18
Nevermind, got it - it's also a registry setting.

Changing the port was the last missing piece.
Got it all working now.

Thanks!

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 12, 2011 10:29 AM          Msg. 5 of 18
Hmmm perhaps not after all...

Registry setting made it so that I no longer have collisions, but now my app won't connect to IQConnect.

The collision was on port 9100, which i changed in registry to 9400.
I'm using DTNIQFeedCOMLib.SymbolLookup3 (which as I understand connects to port 9100). How do I make SymbolLookup3 connect to 9400?

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: May 12, 2011 10:39 AM          Msg. 6 of 18
That interface should be correctly querying the registry for the correct port number. Only if it fails to access the port in the registry will it default to 9100.

You might need to restart your app to make sure the interface gets reinstatiated.

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 16, 2011 06:47 PM          Msg. 7 of 18
Working fine. Thank You.

Now seeing occasional IQConnect crashes followed by restarts (attaching crashlog):

Faulting application name: IQConnect.exe, version: 4.7.2.0, time stamp: 0x4c926df4
Faulting module name: IQConnect.exe, version: 4.7.2.0, time stamp: 0x4c926df4
Exception code: 0xc0000005
Fault offset: 0x0000d79c
Faulting process id: 0x14b4
Faulting application start time: 0x01cc141e47d55850
Faulting application path: C:\Program Files\DTN\IQFeed\IQConnect.exe
Faulting module path: C:\Program Files\DTN\IQFeed\IQConnect.exe
Report Id: 3355ff3a-8013-11e0-87da-90e6ba25231c

Not something I would like to deploy this to production environment :)

Any way I can at least programmatically capture this type of event (all I'm using is DTNIQFeedCOMLib.SymbolLookup3 & DTNIQFeedCOMLib.LevelOne)? If nothing else I would like to catch this type of situations an alert our tech team of a possible issue.

This is what I've been trying (no luck though because the ErrorDataReceived doesn't get triggered):

System.Diagnostics.ProcessStartInfo processStartInfo = new System.Diagnostics.ProcessStartInfo(
_IQConnectPath,
string.Format(
"-product {0} -version {1} -login {2} -password {3} -autoconnect -savelogininfo",
_AppName,
_AppVersion,
_Username,
_Password
)
);
processStartInfo.WorkingDirectory = iqDirectoryPath;
processStartInfo.UseShellExecute = false;
processStartInfo.ErrorDialog = false;
processStartInfo.RedirectStandardError = true;

_IQConnectProcess = System.Diagnostics.Process.Start(processStartInfo);
_IQConnectProcess.EnableRaisingEvents = true;

_IQConnectProcess.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(IQConnectProcess_ErrorDataReceived);
_IQConnectProcess.Exited += new EventHandler(IQConnectProcess_Exited);



File Attached: CRASHLOG.TXT (downloaded 1533 times)

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 16, 2011 06:53 PM          Msg. 8 of 18
Also getting missing prices often trying to parse Ask, Bid & Last price.
I understood these would be on positions 4, 11 & 12? (http://www.iqfeed.net/dev/api/docs/UpdateSummaryMessageFormat.cfm)

Pasting a few messages we consider as BAD, gotten from LevelOne_Fire_OnSummaryMsg & LevelOne_Fire_OnUpdateMsg

P,QGCJ13,25,0,,,0,0,0,0,0,0,0,0,,,0.,01:00:00t,0,0,0,0.,,0,,0,,,,,,,,04/26/2013,,,,,,,,,,,,,11,1,710,00,,0,0,0,0,0,,,,,,,,,,01:00:00,,
P,QGCU11,25,0,,,0,0,0,0,0,0,0,0,,,0.,01:00:00t,0,0,0,0.,,0,,0,,,,,,,,09/28/2011,,,,,,,,,,,,,11,1,134,00,,0,0,0,0,0,,,,,,,,,,01:00:00,,
P,QPAZ14,24,0,,,0,0,0,0,0,0,0,0,,,0.,01:00:00t,0,0,0,0.,,0,,0,,,,,,,,12/29/2014,,,,,,,,,,,,,12,2,1323,00,,0,0,0,0,0,,,,,,,,,,01:00:00,,
Q,QPLJ12,24,1851.0,-21.8,-0.012333107,0,3,0,0,0,1768.9,0,3,,,0.,22:56:14a,24,0,1767.6,1768.9,,1767.6,,,,,,,05/01/2011,,1851.0,04/26/2012,,,83.4,0.,,,,,,0,,,11,1,345,00,,0,0,0,0,0,,,,210577,,05/16/2011,,,,22:56:14,,
Q,QPLJ12,24,1851.0,-21.8,-0.012333107,0,3,0,0,0,1768.7,0,1,,,0.,22:56:14a,24,0,1767.6,1768.7,,1767.6,,,,,,,05/01/2011,,1851.0,04/26/2012,,,83.4,0.,,,,-0.2,,0,,,11,1,345,00,,0,0,0,0,0,,,,210577,,05/16/2011,,,,22:56:14,,
Q,QPLJ12,24,1851.0,-21.8,-0.012333107,0,3,0,0,0,1768.9,0,3,,,0.,22:56:14a,24,0,1767.6,1768.9,,1767.6,,,,,,,05/01/2011,,1851.0,04/26/2012,,,83.4,0.,,,,0.2,,0,,,11,1,345,00,,0,0,0,0,0,,,,210577,,05/16/2011,,,,22:56:14,,
Q,QPLJ12,24,1851.0,-21.8,-0.012333107,0,3,0,0,0,1768.5,0,1,,,0.,22:56:14a,24,0,1767.6,1768.5,,1767.6,,,,,,,05/01/2011,,1851.0,04/26/2012,,,83.4,0.,,,,-0.4,,0,,,11,1,345,00,,0,0,0,0,0,,,,210577,,05/16/2011,,,,22:56:14,,
Q,QPLJ12,24,1851.0,-21.8,-0.012333107,0,3,0,0,0,1768.9,0,3,,,0.,22:56:14a,24,0,1767.6,1768.9,,1767.6,,,,,,,05/01/2011,,1851.0,04/26/2012,,,83.4,0.,,,,0.4,,0,,,11,1,345,00,,0,0,0,0,0,,,,210577,,05/16/2011,,,,22:56:14,,

Thoughts?

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: May 17, 2011 09:03 AM          Msg. 9 of 18
We certainly want to figure out what is causing the crashes.

That crashlog indicates that something went wrong during an authentication sequence.

It looks like you've been logging in a lot (~600 times today alone). Does your app do this by design? Or is the feed crashing that frequently and causing you to relogin?

would it be possible for you to send me a copy of your app that I can run locally?
Edited by DTN_Steve_S on May 17, 2011 at 09:04 AM

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 17, 2011 09:10 AM          Msg. 10 of 18
It was by design to try & restart the IQconnect on 15 sec intervals.
Since then I changed it so that I only connect once when I start the service, but I'm still noticing the same type of issue.

Will see if can be authorized to send you at least a part of the project, but not sure if I will be since it's a proprietary code.

Anything else we can do without me sending out the sources?

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 17, 2011 10:48 AM          Msg. 11 of 18
Wow just saw IQConnect process eating up 1.3G of RAM !?
Had to kill the process and restart our app.

MAJOR ISSUE!

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: May 17, 2011 11:09 AM          Msg. 12 of 18
It sounds like your app isn't keeping up with the feed. The only thing that will cause IQConnect to consume a large amount of RAM is if it is queuing data while waiting for it to be delivered to your app.

I would recommend removing your data processing from the app temporarily to see if you can duplicate the issue while just throwing away the data you receive from the feed. If all is well, you can start adding processing code back in until you find the culprit that is causing a bottleneck.

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 17, 2011 11:26 AM          Msg. 13 of 18
K, makes sense. Will take a look at that one.

Anyway we can proceed pushing on the login issue?

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 18, 2011 08:13 AM          Msg. 14 of 18
Posting a simplified solution showing closely what we are doing.
I've replaced all of the processing we are doing with simple Console.WriteLine lines.

Please run the solution and you'll notice 2 issues (put in some real credentials in Program.cs):

1. Memory consumption for IQConnect is going up & down but is steadily increasing, which suggests a memory leak.
2. Within minutes after starting we start receiving only symbol lookup results. No timestamps, no quotes. It looks like DTNIQFeedCOMLib.LevelOne stops working for some reason.

Need to get to the bottom of this ASAP.
Please advise.

Any way I can contact developer support by phone so we can accelerate the process?

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: May 18, 2011 09:58 AM          Msg. 15 of 18
I've been playing around with your app for a bit this morning and interestingly enough, I haven't been able to duplicate the issue you describe using the code you sent.

I'm still digging into this but, can you tell me what the purpose is of unwatching and relooking up symbols every 15s? I'm not sure exactly what you are attempting to accomplish with this design.

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 18, 2011 02:47 PM          Msg. 16 of 18
Unwatching & relooking was an idea on how to get new futures when they come in.
The 15 second interval is ridiculous naturally, but I've used it on purpose to make sure the mechanism is working for us, and working well.

djmitic
-Interested User-
Posts: 12
Joined: May 12, 2011


Posted: May 20, 2011 11:49 AM          Msg. 17 of 18
Jay & Steve,

Thank you for your support.

We detected an issue on our side, fixed it & are now no longer seeing any issues. We'll keep it running day&night for a couple of days so we can confirm everything is OK, but it looks like we're out of the woods.

The issue we were having is that we unknowingly kept instantiating your COM components as well as trying to start IQConnect. It was not obvious because our service was running on a schedule and it somehow slipped of of my mind that instantiations could have been (and were) happening at each schedule interval.

Again thank you so much - you've been great.

I'm thinking our job is done :)

euro99
-Interested User-
Posts: 1
Joined: Jun 22, 2011


Posted: Jun 22, 2011 12:14 PM          Msg. 18 of 18
Out of interest, did you manage to get IQConnect.exe running reliably inside a Windows Service? and - if so - what security did you run it under. I am having real problems getting it to run unattended, without user interaction enabled (which is forbidden under Windows 7 in any case).

The connect.exe application seems to start ok, but the connect command (which we send via TCP/IP) does not result in a connection. Commands such as register app, set password, etc. get the correct response but otherwise it is all empty S,STATS messages.

Anyone else manage to get it running inside a service?
 

 

Time: Fri September 6, 2024 1:25 PM CFBB v1.2.0 14 ms.
© AderSoftware 2002-2003