public static void Main(string[] args) { var ipAddress = IPAddress.Loopback; if (args.Length == 1) { ipAddress = IPAddress.Parse(args[0]); } var fileTransferImpl = new FileTransferImp(); var dispatcherThread = new DispatcherThread(Dispatcher.Run); dispatcherThread.Start(); var server = new IpcServer<IFileTransfer>(fileTransferImpl, dispatcherThread.Dispatcher, ipAddress, 63000, new JsonDotNetSerializer()); server.ClientConnected += OnClientConnected; server.ClientDisconnected += OnClientDisconnected; server.Listen(); Console.WriteLine("FileTransferServer service running, press any key to exit."); Console.ReadLine(); server.ClientDisconnected -= OnClientDisconnected; server.ClientConnected -= OnClientConnected; server.Dispose(); fileTransferImpl.Dispose(); dispatcherThread.Join(); }
public static void Main(string[] args) { var ipAddress = IPAddress.Loopback; if (args.Length == 1) { ipAddress = IPAddress.Parse(args[0]); } var fileTransferImpl = new FileTransferImp(); var dispatcherThread = new DispatcherThread(Dispatcher.Run); dispatcherThread.Start(); var server = new IpcServer <IFileTransfer>(fileTransferImpl, dispatcherThread.Dispatcher, ipAddress, 63000, new JsonDotNetSerializer()); server.ClientConnected += OnClientConnected; server.ClientDisconnected += OnClientDisconnected; server.Listen(); Console.WriteLine("FileTransferServer service running, press any key to exit."); Console.ReadLine(); server.ClientDisconnected -= OnClientDisconnected; server.ClientConnected -= OnClientConnected; server.Dispose(); fileTransferImpl.Dispose(); dispatcherThread.Join(); }