private void reconnectPlayoutTimerElapsed(object sender, EventArgs e) { _compTalker.DataArrival -= compTalkerDataArrival; _compTalker.Connected -= compConnectedTo; _compTalker.ConnectionClosed -= compConnectionClosed; //_compTalker.ConnectionRefused -= compConnectionRefused; _compTalker.Dispose(); _compTalker = null; _clockTalker.DataArrival -= clockTalkerDataArrival; _clockTalker.Connected -= clockConnectedTo; _clockTalker.ConnectionClosed -= clockConnectionClosed; _clockTalker.Dispose(); _clockTalker = null; initializeTalker(); }
private void initializeTalker() { if (_compTalker != null) { _compTalker.Dispose(); } _compTalker = new Talker("1"); _compTalker.DataArrival += new Talker.DataArrivalHandler(compTalkerDataArrival); _compTalker.Connected += new Talker.ConnectionHandler(compConnectedTo); _compTalker.ConnectionClosed += new Talker.ConnectionClosedHandler(compConnectionClosed); //_compTalker.ConnectionRefused += new Talker.ConnectionRefusedHandler(compConnectionRefused); _compTalker.Connect(ConfigurationManager.AppSettings["PlayoutIP"].ToString(), ConfigurationManager.AppSettings["CompPlayoutPort"]); if (_clockTalker != null) { _clockTalker.Dispose(); } _clockTalker = new Talker("2"); _clockTalker.DataArrival += new Talker.DataArrivalHandler(clockTalkerDataArrival); _clockTalker.Connected += new Talker.ConnectionHandler(clockConnectedTo); _clockTalker.ConnectionClosed += new Talker.ConnectionClosedHandler(clockConnectionClosed); //_clockTalker.ConnectionRefused += new Talker.ConnectionRefusedHandler(clockConnectionRefused); _clockTalker.Connect(ConfigurationManager.AppSettings["PlayoutIP"].ToString(), ConfigurationManager.AppSettings["ClockPlayoutPort"]); }