You can monitor the error cluster coming out of your Datasocket fuctions (open, close, read, write) to see if an error gets thrown or if there is a timeout due to no valid connection with the Datasocket Server. You can build this error-handling into your code so that it can be specific to your application. Once you have opened a connection, you can simply perform a Datasocket write or read and if it works without error, you know the connection is valid.