public bool CloseConnection() { if ((mSocketServiceProvider != null)) { mSocketServiceProvider.Close(); mSocketServiceProvider = null; Intent serviceIntent = new Intent(Application.Context, typeof(ProviderService)); Application.Context.StopService(serviceIntent); return(true); } else { return(false); } }
// this is where the connection socket is called 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 } }