public void connect(String url, IAudioServiceCallBack callback, EventHandler openedEvt = null, EventHandler faultEvt = null) //url = "net.tcp://localhost:8080/AudioService"
        {
            try
            {
                 duplex = new DuplexChannelFactory<IAudioService>(callback, new NetTcpBinding(),
                     new EndpointAddress(url));
                
                 service = duplex.CreateChannel();
                 channel = (ICommunicationObject)service;
                 IClientChannel c = (IClientChannel)channel;
                 c.OperationTimeout = TimeSpan.FromSeconds(5);
                 
                 channel.Opened += new EventHandler(delegate(object o, EventArgs e)
                    {
                        Console.WriteLine("Connection ok!");
                    });

                if(openedEvt != null)
                 channel.Opened += openedEvt;
                if(faultEvt != null)
                 channel.Faulted += faultEvt;
                 channel.Faulted += new EventHandler(delegate(object o, EventArgs e)
                    {
                        Console.WriteLine("Connection lost");
                    });

            }
            catch (Exception e)
            {
                Console.WriteLine("Connection error: " + e.Message);
            }
        }
        public AudioService()
        {
            Console.WriteLine("New AudioService Connection");
            try
            {

                this.callback = OperationContext.Current.GetCallbackChannel<IAudioServiceCallBack>();
                /*if (!listeners.ContainsValue(callback))
                {
                    listeners.Add(logid, callback);
                }
                */

                AudioServiceHost.audiomgr.periodicUpdate += new EventHandler(audiomgr_periodicUpdate);
                AudioServiceHost.audiomgr.instantUpdate += new EventHandler(audiomgr_instantUpdate);

            }
            catch { }
        }