- This topic has 8 replies, 3 voices, and was last updated 10 years, 5 months ago by Anonymous.
-
AuthorPosts
-
March 21, 2014 at 16:55 #2389AnonymousInactive
Hi, how can I reconnect to a remote address?
Currently I verified the following effect for Android and Windows Phone.
A TCP connection is established to a remote peer, then the remote peer is restarted, so that the connection is broken.
Now a new call of TCPConnection.GetConnection leads to the following exceptionNetworkCommsDotNet.ConnectionShutdownException: Attempted to wait for connection establish on a connection that is already shutdown. at NetworkCommsDotNet.Connections.Connection.WaitForConnectionEstablish(Int32 waitTimeoutMS)
March 25, 2014 at 01:42 #2393AnonymousInactiveHeya Ekki,
Could you possibly provide a code sample that allows us to reproduce this problem?
Kind regards,
MarcMarch 28, 2014 at 16:53 #2427AnonymousInactiveHi Marc,
I did a lot of Investigation, but finally managed to isolate the circumstances in which the error occurs.
It happens when a tcp and upd connection are created.var connectionInfo = new ConnectionInfo(new IPEndPoint(IPAddress.Parse("192.168.2.100"), Port)); var tcpConnection = TCPConnection.GetConnection(connectionInfo, true); var updConnection = UDPConnection.GetConnection(connectionInfo, UDPOptions.None, true);
Then also NetworkComms.AppendGlobalConnectionCloseHandler doesn’t work anymore. The ConnectionClosedHandler is never called. So NetworkComms seems not to realize that the connection is closed.
March 28, 2014 at 18:20 #2428AnonymousInactiveHi, I think the source of the behaviour is clear now, it’s the use of the same ConnectionInfo object for both Connections. Creating two connections with different ConnnectionInfo objects works.
March 28, 2014 at 22:11 #2429AnonymousInactiveHeya Ekki,
Glad you found a solution. This problem is caused due to a design choice we made in version 2.0.0 which caused a new connection to incorporate the provided ConnectionInfo parameter. This means connection specific information is added to the ConnectionInfo which obviously causes issues if two connections share the connectionInfo. I will discuss possible resolutions with our other developers.
Kind regards,
MarcJuly 15, 2014 at 09:52 #2777AnonymousInactiveHi marcF
I also encountered this problem. Even I Creating two connections with different ConnnectionInfo objects ,It’s also occur.The error message is the same.
Attempted to wait for connection establish on a connection that is already shutdown
my Client code like as below :
private void ConnectionStateChange(connection status) { int num = 0; int retryCount = 1000; int retrySpanInMSecs = 1000; do { try { connection= TCPConnection.GetConnection(connnectionInfo); lblMessage.Text="ok"; break; } catch (Exception ex) { num++; if (num < retryCount) { lblMessage.Text="error"; Thread.Sleep(retrySpanInMSecs); } } } while (num < retryCount); }
Please give me some help
Thanks
Best Regards
July 16, 2014 at 21:42 #2786AnonymousInactiveHeya msdc123,
What version of the library are you using?
Regards,
MarcJuly 17, 2014 at 01:39 #2788AnonymousInactiveHeya MarcF:
the version is 3.0.
I think the reason may be is when the server Application close,
The client doesn’t not clear the connection in networkcomms’s dictionary.
and the connnection state is shutdown.when server restart and Client attempt to reconnect. the error will occur.
Best Regards
wenjie5816July 17, 2014 at 07:57 #2789AnonymousInactiveI’ll keep investigating.
Regards,
Marc -
AuthorPosts
- You must be logged in to reply to this topic.