static void Main(string[] args) { var logger = new Logger(logLevel: LogLevel.Debug); var stats = new Stats(); var addr = new[] { "127.0.0.1", "8098" }; //defaults if (null != args && args.Length > 0) { var parts = args[0].Split(':'); if (parts.Length > 1) { addr[1] = parts[1]; } addr[0] = parts[0]; } var ip = addr[0]; var port = Convert.ToInt32(addr[1]); var ipEndpoint = new IPEndPoint(IPAddress.Any, port); var useCompression = false; var compressionThreshold = 131072; //128KB var zkRepository = new DemoZkRepository(); var tcphost = new TcpHost(ipEndpoint, logger, stats, zkRepository); tcphost.UseCompression = useCompression; tcphost.CompressionThreshold = compressionThreshold; var simpleContract = new DataContractImpl(); tcphost.AddService <IDataContract>(simpleContract); var complexContract = new ComplexDataContractImpl(); tcphost.AddService <IComplexDataContract>(complexContract); var test = new Test(); tcphost.AddService <ITest>(test); tcphost.Open(); Console.WriteLine("Press Enter to stop the dual host test."); Console.ReadLine(); tcphost.Close(); Console.WriteLine("Press Enter to quit."); Console.ReadLine(); }
static void Main(string[] args) { var logger = new Logger(logLevel: LogLevel.Debug); var stats = new Stats(); var ip = ConfigurationManager.AppSettings["ip"]; var port = Convert.ToInt32(ConfigurationManager.AppSettings["port"]); var ipEndpoint = new IPEndPoint(IPAddress.Any, port); var useCompression = false; var compressionThreshold = 131072; //128KB var pipeName = "ServiceWireTestHost"; var nphost = new NpHost(pipeName, logger, stats); var tester = new NetTester(); nphost.AddService <INetTester>(tester); var mytester = new MyTester(); nphost.UseCompression = useCompression; nphost.CompressionThreshold = compressionThreshold; nphost.AddService <IMyTester>(mytester); nphost.Open(); var tcphost = new TcpHost(ipEndpoint, logger, stats); tcphost.UseCompression = useCompression; tcphost.CompressionThreshold = compressionThreshold; tcphost.AddService <INetTester>(tester); tcphost.AddService <IMyTester>(mytester); var valTypes = new ValTypes(); tcphost.AddService <IValTypes>(valTypes); tcphost.Open(); Console.WriteLine("Press Enter to stop the dual host test."); Console.ReadLine(); nphost.Close(); tcphost.Close(); Console.WriteLine("Press Enter to quit."); Console.ReadLine(); }
public void Dispose() { _tcphost.Close(); }
public override void OnDisable() { _server.Close(); Log.InfoFormat("Dev Tools Stopped"); }