protected override async Task <ThingState> OnInitAsync() { var port = _gatewaySetupInfo.GatewayType == "HmIp" ? CcuRpcPorts.HomeMaticIp : CcuRpcPorts.HomeMatic; _xmlRpcApi = HomeMaticXmlRpcApiBuilder.Create() .ForUrl($"{_gatewaySetupInfo.Address}:{port}") .Build(); _connection = new CcuConnection(_xmlRpcApi); var xmlRpcServer = new XmlRpcServer(new AspNetCoreHttpServer(), new XmlRpcServerMethods(), Encoding.GetEncoding("iso-8859-1")); xmlRpcServer.Urls.Add("http://homie-workstation:12345/"); _eventServer = new CcuXmlRpcEventServer(xmlRpcServer); _eventServer.RegisterEventHandler(new HomeMaticGatewayEventHandler(_mediator, $"GW_{_gatewaySetupInfo.Id.Gateway}")); await _eventServer.StartAsync(); await _xmlRpcApi.InitAsync("http://homie-workstation:12345/", $"GW_{_gatewaySetupInfo.Id.Gateway}"); return(ThingState.Online); }
public static void Main(string[] args) { XmlRpcServer server = new XmlRpcServer(25566); server.Add("MyProc", new MyProc()); server.Start(); }
public static void Main(string[] args) { // XML-RPC-Stuff // Use the console logger above. Nwc.XmlRpc.Logger.Delegate = new Nwc.XmlRpc.Logger.LoggerDelegate(WriteEntry); XmlRpcSLConnector = new XmlRpcServer(port); XmlRpcSLConnector.Add("XmlRpcSLConnector", new CSSLAgentServer()); Console.WriteLine("Web Server Running on port {0} ... Press ^C to Stop...", port); XmlRpcSLConnector.Start(); }
public async Task RunAsync() { var xmlRpcServer = new XmlRpcServer(new AspNetCoreHttpServer()); xmlRpcServer.Urls.Add("http://localhost:12345/"); xmlRpcServer.Methods.RegisterMethods(this); await xmlRpcServer.StartAsync(); var xmlRpcClient = new XmlRpcProxyBuilder <ISampleXmlRpcClient>(new ProxyBuilder <ISampleXmlRpcClient>(), new DelegateHttpClientFactory(_ => new HttpClient())) .ForUrl("http://localhost:12345") .Build(); var result = await xmlRpcClient.DoSomething("qwertz"); Console.WriteLine($"Method result: {result}"); var asyncResult = await xmlRpcClient.DoSomethingAsync("12345"); Console.WriteLine($"Async method result: {asyncResult}"); await xmlRpcServer.StopAsync(); }
public XmlRpcManager() { //XmlRpcUtil.ShowOutputFromXmlRpcPInvoke(); server = new XmlRpcServer(); getPid = (parms, result) => responseInt(1, "", Process.GetCurrentProcess().Id)(result); }
public XmlRpcManager(Master_API.ROSMasterHandler _handler = null) { handler = _handler; server = new XmlRpcServer(); getPid = (parms, result) => responseInt(1, "", Process.GetCurrentProcess().Id)(result); }