public override bool RegisterUser(UserNodeCore context, User user, string serviceNodeAddress, string callbackAddress) { try { ClientCallback callback = new ClientCallback(context); // First of all, set up the connection EndpointAddress endPointAddress = new EndpointAddress(serviceNodeAddress); WSDualHttpBinding binding = new WSDualHttpBinding(); binding.ClientBaseAddress = new Uri(callbackAddress); DuplexChannelFactory <IDarPooling> factory = new DuplexChannelFactory <IDarPooling>( callback, binding, endPointAddress); context.ServiceProxy = factory.CreateChannel(); } catch { context.ServiceProxy = null; return(false); } Command c = new Communication.RegisterUserCommand(user); try { context.ServiceProxy.HandleDarPoolingRequest(c); } catch (TimeoutException e) { context.ServiceProxy = null; throw e; } return(true); }
public static void TestCommands(Command c) { string serviceNodeAddress = "http://localhost:1111/Catania"; string callbackAddress = "http://localhost:2222/prova"; ClientCallback callback = new ClientCallback(); // First of all, set up the connection EndpointAddress endPointAddress = new EndpointAddress(serviceNodeAddress); WSDualHttpBinding binding = new WSDualHttpBinding(); binding.ClientBaseAddress = new Uri(callbackAddress); DuplexChannelFactory <IDarPooling> factory = new DuplexChannelFactory <IDarPooling>( callback, binding, endPointAddress); IDarPooling serviceProxy = factory.CreateChannel(); serviceProxy.HandleDarPoolingRequest(c); }
public override bool Join(UserNodeCore context, string username, string password, string serviceNodeAddress, string callbackAddress) { try { ClientCallback callback = new ClientCallback(context); // First of all, set up the connection EndpointAddress endPointAddress = new EndpointAddress(serviceNodeAddress); WSDualHttpBinding binding = new WSDualHttpBinding(); binding.ClientBaseAddress = new Uri(callbackAddress); DuplexChannelFactory <IDarPooling> factory = new DuplexChannelFactory <IDarPooling>( callback, binding, endPointAddress); context.ServiceProxy = factory.CreateChannel(); } catch { context.ServiceProxy = null; return(false); } // Now, hopefully you have a working ServiceProxy. string passwordHash = Communication.Tools.HashString(password); Command c = new JoinCommand(context.UserNode, username, passwordHash); try { context.ServiceProxy.HandleDarPoolingRequest(c); } catch (TimeoutException e) { context.ServiceProxy = null; throw e; } // Finally, if Join is NOT successfull, remove reference (UserNodeCore.onResultReceive) return(true); }
public override bool RegisterUser(UserNodeCore context, User user, string serviceNodeAddress, string callbackAddress) { try { ClientCallback callback = new ClientCallback(context); // First of all, set up the connection EndpointAddress endPointAddress = new EndpointAddress(serviceNodeAddress); WSDualHttpBinding binding = new WSDualHttpBinding(); binding.ClientBaseAddress = new Uri(callbackAddress); DuplexChannelFactory<IDarPooling> factory = new DuplexChannelFactory<IDarPooling>( callback, binding, endPointAddress); context.ServiceProxy = factory.CreateChannel(); } catch { context.ServiceProxy = null; return false; } Command c = new Communication.RegisterUserCommand(user); try { context.ServiceProxy.HandleDarPoolingRequest(c); } catch (TimeoutException e) { context.ServiceProxy = null; throw e; } return true; }
public override bool Join(UserNodeCore context, string username, string password, string serviceNodeAddress, string callbackAddress) { try { ClientCallback callback = new ClientCallback(context); // First of all, set up the connection EndpointAddress endPointAddress = new EndpointAddress(serviceNodeAddress); WSDualHttpBinding binding = new WSDualHttpBinding(); binding.ClientBaseAddress = new Uri(callbackAddress); DuplexChannelFactory<IDarPooling> factory = new DuplexChannelFactory<IDarPooling>( callback, binding, endPointAddress); context.ServiceProxy = factory.CreateChannel(); } catch { context.ServiceProxy = null; return false; } // Now, hopefully you have a working ServiceProxy. string passwordHash = Communication.Tools.HashString(password); Command c = new JoinCommand(context.UserNode, username, passwordHash); try { context.ServiceProxy.HandleDarPoolingRequest(c); } catch (TimeoutException e) { context.ServiceProxy = null; throw e; } // Finally, if Join is NOT successfull, remove reference (UserNodeCore.onResultReceive) return true; }
public static void TestCommands(Command c) { string serviceNodeAddress = "http://localhost:1111/Catania"; string callbackAddress = "http://localhost:2222/prova"; ClientCallback callback = new ClientCallback(); // First of all, set up the connection EndpointAddress endPointAddress = new EndpointAddress(serviceNodeAddress); WSDualHttpBinding binding = new WSDualHttpBinding(); binding.ClientBaseAddress = new Uri(callbackAddress); DuplexChannelFactory<IDarPooling> factory = new DuplexChannelFactory<IDarPooling>( callback, binding, endPointAddress); IDarPooling serviceProxy = factory.CreateChannel(); serviceProxy.HandleDarPoolingRequest(c); }