Open jpvdmerwe opened 8 years ago
Hi JP,
AFAIK the value of ConnectionState cannot be relied upon for unmanaged connections. This state is primarily intended for use with managed connections. That being the case the bug is probably the connection state for unmanaged connections should always be ConnectionState.Undefined
.
I'll raise this as a bug for now.
Marc
Hi Marc,
Thanks for the response. I'm using the LastTrafficTime from the ConnectionInfo to determine whether to close the connection and attempt to reconnect.
Do you perhaps have a better approach?
JP
JP, in 95% of cases the managed connection is what you want to be using. How come you are using unmanaged connections?
Marc,
I do use the managed connections when communicating with other NetworkComms.Net applications, however I use the unmanaged connections when communicating with 3rd party devices like GPS Devices, Serial Comms over TCP/IP devices, etc.
I did too
Hi,
I might have found a possible bug when trying to reconnect with an unmanaged connection.
First I create my unmanaged connection:
After this I check the conn.ConnectionInfo.ConnectionState to see if it is ConnectionState.Established.
Here is my testing scenario:
Am I using the ConnectionState incorrectly?
Update: If you do not use the CloseConnection method before creating the new connection it will use the last ConnectionInfo for the IP / Port. Not sure if this is still a bug, for now everything seems fine.
Kind Regards, JP