public bool CloseConnection()
 {
     if ((_mSocketServiceProvider != null))
     {
         _mSocketServiceProvider.Close();
         _mSocketServiceProvider = null;
         return(true);
     }
     else
     {
         return(false);
     }
 }
 protected override void OnServiceConnectionResponse(SAPeerAgent p0, SASocket socket, int result)
 {
     if ((result == SAAgent.ConnectionSuccess))
     {
         if ((socket != null))
         {
             _mSocketServiceProvider = ((ProviderServiceSocket)(socket));
             _mSocketServiceProvider.Send(CHANNEL_ID, System.Text.Encoding.ASCII.GetBytes("Connected"));
         }
     }
     else if ((result == SAAgent.ConnectionAlreadyExist))
     {
         Android.Util.Log.Debug(TAG, "onServiceConnectionResponse, CONNECTION_ALREADY_EXIST");
     }
 }
        protected override void OnServiceConnectionResponse(SAPeerAgent p0, SASocket socket, int result)
        {
            // Cache(socket);
            if ((result == SAAgent.ConnectionSuccess))
            {
                if ((socket != null))
                {
                    mSocketServiceProvider = ((ProviderServiceSocket)(socket));
                    mSocketServiceProvider.Send(CHANNEL_ID, System.Text.Encoding.ASCII.GetBytes(Message));
                }
            }
            else if ((result == SAAgent.ConnectionAlreadyExist))
            {
#if DEBUG
                Console.WriteLine("onServiceConnectionResponse, CONNECTION_ALREADY_EXIST");
#endif
            }
        }