It seems that when an AsyncStream is initialized in Prefix mode with an InputStream the Error event is not raised when the server drops the connection. Without and Inputstream the event is raised when the connection is lost. Am I missing something related to the transfer modes? or is there another way to tell if the connection is lost?
You should implement both the Terminated and the Error events. One of them will be raised when the network driver recognizes that the connection has broken. This may not happen immediately and may not happen at all. There is however not a bug.
A good measure is to send a "ping" message every second and close the connection if there was no response after X seconds.