API Support Forum
OEC API > API Support > Auto Reconnect
Author Topic: Auto Reconnect
(10 messages, Page 1 of 1)
Moderators: VPfau
DBrubaker673
Posts: 55
Joined: Jul 18, 2007


Posted: Mar 11, 2008 @ 06:19 AM             Msg. 1 of 10
I have a lot of problems with being disconnected from your servers. Sometimes I call in and yes, your support people know they are down. Other times they say the problem must be on my end.
1. Can you give me some pointers on how to reconnect "automatically"? I see in one of your other responses that the API is supposed to do this, but I don't see it happening. The Disconnect event fires, and it's all over until I manually try to connect.
2. Can you tell me how I can determine if the disconnects are happening at your end, on my end, or somewhere in between?

Thanks,
Dale

Dale
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Mar 11, 2008 @ 08:59 AM             Msg. 2 of 10
Auto-reconnect is always on, but it could be disabled in case of incorrect login or other non-network errors.
You can check whether OEC API is going to reconnect using InAutoReconnect property in OnDisconnect handler.
When Auto-reconnect succeeds, you will get OnLoginComplete event. Note that after reconnect all API objects will be recreated.

2. There is no correct way to determine that programmatically using OEC API. You can manually test network connection using tools such as ping and tracert.
DBrubaker673
Posts: 55
Joined: Jul 18, 2007


Posted: Mar 11, 2008 @ 11:26 AM             Msg. 3 of 10
Serge,

Thanks for your quick response.

I've never seen any sign of an attempt to auto-reconnect, but I've put some code into the Disconnect event to see if it's trying.

When you say "All API objects will be recreated", does that mean I have to re-hook events to OECGlobal? I had assumed it was static.

I can't ping prod.openecry.com --
"Reply from 64.74.106.5 Destination host unreachable" -- so I suppose you have it locked up somehow. Some sites refuse pings...

If I can't ping, and if the API doesn't try to reconnect, then I'm Dead In The Water?

Thanks,
Dale

Dale
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Mar 11, 2008 @ 11:56 AM             Msg. 4 of 10
I mean data objects, such as contracts, orders, positions etc - not the OECGlobal component, so you don't need to re-hook events.

you can ping 64.74.106.5 - that's the firewall.

if you can't connect - i.e. there's a network problem - OEC API will try to reconnect repeatedly until application is terminated.
DBrubaker673
Posts: 55
Joined: Jul 18, 2007


Posted: Mar 11, 2008 @ 02:39 PM             Msg. 5 of 10
Serge, I have auto-reconnect working. At 2:35 I lost connection again, and re-connected.
Another user on AMP/OpenECry had the same disconnection at the same time. He's been sending you emails about the disconnection issues, and you've been claimin that "tick charts overload things", he says.
Another of your AMP customers just now chimed in and said he was given a different excuse.
Another user just told me he uses OEC directly, disconnected for the second time today.
Yesterday when it happened I called Keith, and he said you were down "for a moment" -- took more than 10 minutes I think to come up.
So you have serious connection issues, IMO, and you are stonewalling your customers.
What is the truth? Shall we all give up on OEC?
Thanks,
Dale

Dale
DBrubaker673
Posts: 55
Joined: Jul 18, 2007


Posted: Mar 11, 2008 @ 03:25 PM             Msg. 6 of 10
Serge,

A followup at 3:24 p.m. You've been down for several minutes, and just came back on. During the disconnection I was able to Ping and Tracert 64.74.106.5 without any problem.

Thanks, and good luck,
Dale

Dale
DBrubaker673
Posts: 55
Joined: Jul 18, 2007


Posted: Mar 14, 2008 @ 12:39 AM             Msg. 7 of 10
Serge,

You said, "I mean data objects, such as contracts, orders, positions etc - not the OECGlobal component, so you don't need to re-hook events."

I'm finding that after reconnecting I must resubscribe to ticks for each contract so that ticks are received again in the OnTicksReceived event. Does that make sense? And then sometimes after reconnecting I'm getting an error that I've subscribed to too many contracts -- implying that the subscriptions weren't really "lost." Do I have to unsubscribe then resubscribe after reconnecting? I'm confused. Help?

Thanks,
Dale

Dale
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Mar 14, 2008 @ 10:30 AM             Msg. 8 of 10
On reconnect you need to re-subscribe to everything. You do not need to unsubscribe.

You can check your active subscriptions in OECClient.Subscriptions collection.

OEC API authomatically subscribes for prices of contracts of which you have open positions or orders.
REnikeev8313
Posts: 4
Joined: Dec 13, 2013


Posted: Feb 08, 2014 @ 10:00 AM             Msg. 9 of 10
Quote: I'm finding that after reconnecting I must resubscribe to ticks for each contract so that ticks are received again in the OnTicksReceived event. Does that make sense? And then sometimes after reconnecting I'm getting an error that I've subscribed to too many contracts -- implying that the subscriptions weren't really "lost." Do I have to unsubscribe then resubscribe after reconnecting? I'm confused. Help?


I experience the same problem. If disconnect-connect happens quickly seems that it does not lose contracts' subscription and re-subscribing causes "subscribed to too many contracts". If the delay is bigger it works smoothly.

It can be easily reproduced if you run the app, unplug network to cause disconnect and plug it again.

OEC, is there a workaround to understand whether I need resubscribe?

Ruslan Enikeev
REnikeev8313
Posts: 4
Joined: Dec 13, 2013


Posted: Feb 20, 2014 @ 08:32 PM             Msg. 10 of 10
Hi OEC,

Do you have a solution or workaround for this problem?

Or please confirm that this exception can be ignored without bad consequences.

Thanks

Ruslan Enikeev