API Support Forum
OEC API > API Support > InAutoReconnect
Author Topic: InAutoReconnect
(20 messages, Page 1 of 1)
Moderators: VPfau
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 01, 2010 @ 01:37 AM             Msg. 1 of 20
Hello.

I discovered that the InAutoReconnect property changes its value significantly later than the OnLoginComplete event occurs. If I try to check the InAutoReconnect value immediately after the OnLoginComplete occures (in its own procedure or in the procedure called from it), then InAutoReconnect shown as a false.

How can I get the real status InAutoReconnect without any timer or call additional procedures?
.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 01, 2010 @ 11:26 AM             Msg. 2 of 20
Hello,

InAutoReconnect property is equal to the parameter "AutoReconnect" of Connect(..) method after successful logging in.
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 01, 2010 @ 12:20 PM             Msg. 3 of 20
Thank you, VictorV.

I can get the value of the InAutoReconnect property only after the completion of the OnLoginComplete procedure and all of the procedures that called from it. So, I can't put no code or othe procedures calls in the OnLoginComplete procedure, especially such code or procedures calls that using the status of InAutoReconnect! Is this correct?
.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 01, 2010 @ 12:35 PM             Msg. 4 of 20
This is incorrect. You can put any code to OnLoginComplete procedure.
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 01, 2010 @ 01:07 PM             Msg. 5 of 20
It is not correct at all, imo. I can't put to OnLoginComplete procedure any code, that handles the value of InAutoReconnect because it takes this value (True) only after the completion of OnLoginComplete. It have value False inside all the OnLoginComplete procedure.

I mean a Access (Excel) - VBA.
.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 01, 2010 @ 03:03 PM             Msg. 6 of 20
Could you please explain a goal that you would like to reach by using InAutoReconnect?
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 02, 2010 @ 02:30 AM             Msg. 7 of 20
Dear Victor.

I appreciated that you answer my question with another question :)
Nevertheless...

Sequence of events occurring during the installation of connection is as follows:

ConnectionClosed: True -> False
CompleteConnected: False -> True
InAutoReconnect: False -> True

1. InAutoReconnect is one of the characteristics of the connection. Right? Right.
Consequently, while one of the characteristics of the connection did not possess their values, the connection can not be consider as completed. Right? Right.

Normal human logic violated - the connection is recognized like completed (CompleteConnected), while, as InAutoReconnect not yet take its value.

2. My application can operate in two modes, when the connection is restored manually or automatically. Each mode uses different logic program behavior, uses different variables, that take different values and different segments of code are executing.

I have a few questions (requests):
1. Please answer - whether I right understand the logic of API at connection establishing steps?
2. Is it true my statement in the message http://www.openecry.com/cfbb/index.cfm?page=newreply&topicID=378"eID=1505#NEWMSG?
3. Is it possible to change connection establishing API logic of to a normal, human logic, when InAutoReconnect takes its value before than CompleteConnected take value True? Or ...
4. ... is it possible to add event of InAutoReconnect status change?

If my English is so bad that you can't understand me, let me please to contact with Russian-speaking staff. I know that there are many russians in OEC development team. For example - Sergei Korostelev.

Thank you.


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia

Edited by CChen15 on Jun 2, 2010 at 02:31:33
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 02, 2010 @ 08:56 AM             Msg. 8 of 20
The property InAutoReconnect is working by design: it has TRUE value when OECAPI switches to auto-reconnect mode (if user requested it in Connect(..) method). It cannot get TRUE before the first OnLoginComplete event, because in this case any exception raised by malformed custom code in this event handler would cause infinite loop of reconnections.

So,
1. InAutoReconnect shows the current mode of auto-reconnection feature and doesn't describe the the status of connection. You should use another property to determine the status of connection.

2. Please try to compare what value has InAutoReconnect inside OnLoginComplete after manual calling of Connect(..) and during automatic reconnect.

Answers:
1. No, you didn't understand it right.
2. I don't get what statement did you mention. As I remember I've answered on previous questions/statements.
3. Yes, it is possible. Moreover, it is working such way already.
4. No.
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 02, 2010 @ 12:52 PM             Msg. 9 of 20
Quote: The property InAutoReconnect is working by design ...
I understood it and I'm not satisfied with such design :(

Quote: ... It cannot get TRUE before the first OnLoginComplete event ...
No body say about "before event". I mean that it must get TRUE before OnLoginComplete procedure is ended.

Quote: ... because in this case any exception raised by malformed custom code in this event handler would cause infinite loop of reconnections.
This situation can take place in any other code segment in any other API mechanism, not only with reconnection procedure.

Quote: So,
1. InAutoReconnect shows the current mode of auto-reconnection feature and doesn't describe the the status of connection...
I totally agree with you. In fact the connection has two status - ConnectionClosed and CompleteConnected. In this way... , please see Appendix A below

Quote: ... You should use another property to determine the status of connection.
I use them (ConnectionClosed and CompleteConnected) to determine the status of the connection, but not for the AutoReconnect feature. And I see that connection is established, but I do not know the state of the InAutoReconnect parameter. How do I know this without additional check button pressing? I have a little dashboard. All lights of connection status are green, but only AutoReconnect is gray - unknown status...

Quote: 2. Please try to compare what value has InAutoReconnect inside OnLoginComplete after manual calling of Connect(..) ...
Please, see debug listing in Appendix B below:

Quote: ... and during automatic reconnect.
Let's look at this a little more. Continuation of execution of my application depends on two factors: connection to the server established (ConnectionClosed = FALSE and CompleteConnected = TRUE) and AutoReconnect feature is ON (InAutoReconnect = TRUE). Without implementation of these two conditions I can't allow the application to continue working. I still do not care - what happens "during automatic reconnect". I'm not sure that automatic reconnect will took place.


Appendix A
In fact the connection has two status - ConnectionClosed and CompleteConnected. In this way - why am I still bind AutoReconnect to the connection proper? Not I but you have done this, putting AutoReconnect parameter among necessaries to establish a connection and make it invariable during the whole session. That's why I'm talking about InAutoReconnect as an essential characteristic of the connection.

And the most important thing. I temporarily can do not pay attention on InAutoReconnect value and continue the application. Well, let's say, low-responsibility preparatory operations (subscribing for a contracts, history request etc.) I can get InAutoReconnect value inside their code. However... However, during the lifetime of the application I am forced to constantly monitor its ON status. That's why I started talking about the need of the AutoReconnect_ON and _OFF events.



01; ' Application start
02; ' Some preparing procedures running.
03; ' Connect button pressed
04; 49'980'090 ConnectDisconnect_procedure: Begin
05; 49'980'090 Check_Status procedure: Begin
06; 49'980'090 ConnectionClosed = True
07; 49'980'090 CompleteConnected = False
08; 49'980'090 InAutoReconnect = False
09; 49'980'090 Check_Status procedure: End
10; ' Some code executing
11; 49'980'720 Check_Status procedure: Begin
12; 49'980'740 ConnectionClosed = False
13; 49'980'740 CompleteConnected = False
14; 49'980'740 InAutoReconnect = False
15; 49'980'740 Check_Status procedure: End
16; 49'980'740 ConnectDisconnect_procedure: End
17; ' No code executing. Whait for OnLoginComplete event

18; 49'981'950 OnLoginComplete event procedure: Begin
19; ' No code executing inside this procedure. Check_Status procedure only
20; 49'981'950 Check_Status procedure: Begin
21; 49'981'950 ConnectionClosed = False
22; 49'981'950 CompleteConnected = True
23; 49'981'950 InAutoReconnect = False
24; 49'981'950 Check_Status procedure: End
25; 49'981'950 OnLoginComplete event procedure: End

26; ' No code executing. We don't know status of InAutoReconnect
27; ' Connection completed? Completed, completed! CompleteConnected = True!
28; ' Is AutoReconnect on? Goodness knows... On Russian - X3
29; ' No code executing. We are obliged manually to press Check button...
30; ' ... to get InAutoReconnect status

31; 49'983'670 Button_Check_pressed procedure: Begin
32; 49'983'670 Check_Status procedure: Begin
33; 49'983'670 ConnectionClosed = False
34; 49'983'670 CompleteConnected = True
35; 49'983'670 InAutoReconnect = True
36; 49'983'670 Check_Status procedure: End
37; 49'983'670 Button_Check_pressed procedure: End

Resume:
I obliged to press two buttons instead one.
I obliged for constantly InAutoReconnect status monitoring.
At last I have to totally abandon of this feature because of its unpredictability and uncontrollability.
.



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia

Edited by CChen15 on Jun 2, 2010 at 12:54:00
Edited by CChen15 on Jun 3, 2010 at 11:12:57
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 02, 2010 @ 02:01 PM             Msg. 10 of 20
"At last I have to totally abandon of this feature because of its unpredictability and uncontrollability."
If you will follow the OECAPI design, it will be predictable.
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 02, 2010 @ 02:55 PM             Msg. 11 of 20
Thank you for reply. Your brevity is astonishing.

I did not put a question mark after each sentence, but it does not mean that are no questions.

Where I was not following the OECAPI design? Point it please.

Do you agree that no code can't be placed on the ConnectionComplete procedure, if you plan to use and check the InAutoReconnect value?
.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 02, 2010 @ 02:57 PM             Msg. 12 of 20
You have wrong idea about the goal of InAutoReconnect.
No, I don't agree.
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 02, 2010 @ 03:43 PM             Msg. 13 of 20
Sorry for my English. I corrected the phrase (bold):

"... no code can't be placed on the ConnectionComplete procedure, if you plan to use and check in this code the InAutoReconnect value?"

Wrong idea? May be...
The API doc:
Quote: Checks whether auto-reconnect is in progress now
No more...

Could you designate the mentioned goal?
Correct me please if I was wrong.
.
By the way. Re API doc quote above. Do I understand correctly, that auto-reconnect process is started and "is in progress". Previously, I was not careful to text and considered that the value of TRUE indicates the system is only ready to reconnect. But now it turns out that TRUE indicates that auto-reconnect process has already begun. This is also your documentation as your logic, I can not understand, sorry.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 02, 2010 @ 03:49 PM             Msg. 14 of 20
This property has TRUE value when OECAPI switches to auto-reconnect mode (if user requested it in Connect(..) method). The quoted above phrase means "this feature is enabled and any unexpected disconnection will lead to reconnecting automatically".
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 02, 2010 @ 09:13 PM             Msg. 15 of 20
Thank you, Victor. I'm glad that we cleared at least one question. Thank you once more.

Exactly this way I interpreted the meaning of .InAutoReconnect property.

Next. Let me return to my corrected sentence. Now, in amended form, ...

Quote: "... no code can't be placed on the ConnectionComplete procedure, if you plan to use and check in this code value of the .InAutoReconnect property?"


... is it right now?


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia

Edited by CChen15 on Jun 2, 2010 at 21:14:55
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 03, 2010 @ 08:18 AM             Msg. 16 of 20
I don't see any reason why cannot use this property in the event handler of OnLoginCompleted. I know several applications that use it perfectly.
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 03, 2010 @ 11:30 AM             Msg. 17 of 20
Because .InAutoReconnect doesn't change its value due all OnConnectComplete() running. Please, see carefully debug listing in Appendix B. I had numbered it for your convenience.

I think you don't want to answer my questions :(

I venture to remind you that my interest is not idle. I am a customer OEC, I have a real account and need in support that specified in our contract, no matter how stupid my questions were not. I talked with you not for my pleasure, yours or pleasure of those are reading this topic.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 03, 2010 @ 12:42 PM             Msg. 18 of 20
From my standpoint, I've explaned how InAutoReconnect is working pretty detailed. So, InAutoReconnect is TRUE, if OnLoginComplete is called during auto-reconnect, and FALSE, if ithe call was initiated by manual calling of Connect(). You can see it in your logs.
CChen15
Posts: 121
Joined: Jul 23, 2009


Posted: Jun 03, 2010 @ 02:26 PM             Msg. 19 of 20
Dear Victor, why you are drilling my mind?

Say me, please:

WHO IS TALKING ABOUT "WHAT WILL HAPPENED WHEN AUTO-RECONNECT FEATURE WILL GOES TO WORK?" ?
Who? Not me, but you are only. I'm still not interested in this. Still... You are talking with pleasure with yourself and you don't want answer to my questions, don't want read them carefully. If you are not satisfied with my english, if you can't understand me - say it.

I asked you - is there russians in your team? Are you answered me?
I asked you to contact me with them? Are you answered me?

Are you volunteer or you are official OEC representative?
If the first - please dont waste my time and try to find more effective goals for your free time, and swith me to OEC.

If the second - lets go.

The very first connecting procedure is calling manually. Yes? Yes.
For the Auto-Reconnect feature goes to work, it's necessary to disconnecting was happened.
We have not reached that point. We're talking about the initial application startup and about the very first, initial manual connection.

It's in this and only in this context, I claim all above and ask all my questions.
And in this context I ask you - is it right the following state?

"... no code can't be placed on the ConnectionComplete procedure, if you plan to use and check in this code value of the .InAutoReconnect property at the very first (initial) manual connection establishing. It's because that this property get its value TRUE only after the ConnectionComplete procedure is finished."
.


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chen Hua, Russia

Edited by CChen15 on Jun 3, 2010 at 14:37:37
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 03, 2010 @ 04:17 PM             Msg. 20 of 20
You can send your questions in Russian to Customer Service: support@openecry.com