public RTDClient(string address) { var a = new EndpointAddress(address); var b = new NetTcpBinding(); var f = new DuplexChannelFactory <IRTDServer>(this, b, a); _server = f.CreateChannel(); _server.Register(); }
public void AutoOpen() { // setup support for RTD functions ExcelAsyncUtil.Initialize(); // setup error handler ExcelIntegration.RegisterUnhandledExceptionHandler(ex => "!!! EXCEPTION: " + ex.ToString()); // setup connection to server var a = new EndpointAddress("net.tcp://localhost:8080/hello"); var b = new NetTcpBinding(); var f = new DuplexChannelFactory <IRTDServer>(this, b, a); _server = f.CreateChannel(); _server.Register(); // this makes the server get a callback channel to us so it can call SendValue // increase RTD refresh rate since the 2 seconds default is too slow (move as setting to ribbon later) object app; object rtd; app = ExcelDnaUtil.Application; rtd = app.GetType().InvokeMember("RTD", BindingFlags.GetProperty, null, app, null); rtd.GetType().InvokeMember("ThrottleInterval", BindingFlags.SetProperty, null, rtd, new object[] { 100 }); }