hi
how to set max retry time of reconnection when client lost connection to server?
in my test scenario, my client has connected to a server firstly, then close the server, the client try to reconnect the server always, it couldn't transfer to the status of server shut down or server disconnected.
another question, if the AlternativeEndpointUrls has been set, after client lost connection to main server, Can the client connect to alternative end point automatically?
thanks
how to set max retry time of reconnection
Moderator: uasdknet
-
- Full Member
- Posts: 9
- Joined: 12 Mar 2014, 05:21
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: how to set max retry time of reconnection
Hello,
The max retry time is controlled by the ReconnectDelay parameter in the ClientSettings. The default and minimum value is 10000ms.
The AlternativeEndpointUrls are used whenever a reconnect attempt occurs, however, the selection could be overridden by UpdateEndpoint callback.
Best regards
Support Team
The max retry time is controlled by the ReconnectDelay parameter in the ClientSettings. The default and minimum value is 10000ms.
The AlternativeEndpointUrls are used whenever a reconnect attempt occurs, however, the selection could be overridden by UpdateEndpoint callback.
Best regards
Support Team
-
- Full Member
- Posts: 9
- Joined: 12 Mar 2014, 05:21
Re: how to set max retry time of reconnection
hi
I mean the client try to reconnect the server always after losing connection, it couldn't transfer to the status of server shut down or server disconnected. I think that reconnect delay is the interval between reconnection.
my connection code is like
The AlternativeEndpointUrls are never used whenever a reconnect attempt occurs
I mean the client try to reconnect the server always after losing connection, it couldn't transfer to the status of server shut down or server disconnected. I think that reconnect delay is the interval between reconnection.
my connection code is like
Code: Select all
m_Session = new Session(m_Application);
m_Session.UseDnsNameAndPortFromDiscoveryUrl = true;
m_Session.AlternativeEndpointUrls = new List<string>();
m_Session.AlternativeEndpointUrls.Add(AlternativeUrl);
m_Session.AutomaticReconnect = true;
// Attach to events
m_Session.SessionValidationError += new SessionValidationEventHandler(Session_SessionValidationError);
m_Session.ConnectionStatusUpdate += new ServerConnectionStatusUpdateEventHandler(Session_ServerConnectionStatusUpdate);
m_Session.UpdateEndpoint += new UpdateEndpointEventHandler(Session_UpdateEndpoint);
m_Session.Connect(endpointDescription, m_Session.DefaultRequestSettings);
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: how to set max retry time of reconnection
Hello,
the AlternativeEndpointUrls are used for connecting if the inital connect fails and retryInitialConnect is set to RetryInitialConnet.Yes. Once a connection could be created, only the Endpoint that worked is used for reconnecting. In other words: the alternative is only tried in case the initial failed. However in your case the initial has worked once, and by this the SDK will always try to reconnect to that one.
Best Regards
Support Team
the AlternativeEndpointUrls are used for connecting if the inital connect fails and retryInitialConnect is set to RetryInitialConnet.Yes. Once a connection could be created, only the Endpoint that worked is used for reconnecting. In other words: the alternative is only tried in case the initial failed. However in your case the initial has worked once, and by this the SDK will always try to reconnect to that one.
Best Regards
Support Team
-
- Full Member
- Posts: 9
- Joined: 12 Mar 2014, 05:21
Re: how to set max retry time of reconnection
hi
after I have changed the connection code to
then start main server and alternative server, close the main server, client do the initial connection, but the client always try to connect the main server, it does not transfer to alternative server.
after I have changed the connection code to
Code: Select all
m_Session.Connect(endpointDescription, RetryInitialConnect.Yes, m_Session.DefaultRequestSettings);