using System; using System.Collections.Generic; using System.Linq; using System.Text; using log4net; namespace LS100PortProxy { /// /// http://msdn.microsoft.com/en-GB/library/bbx2eya8.aspx /// Async server socket msdn /// http://msdn.microsoft.com/en-us/library/5w7b7x5f.aspx /// class Program { static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); ILog _log = LogManager.GetLogger("Main"); _log.Info("PortProxy started"); if ((args.Length != 4) && (args.Length != 0)) { Console.WriteLine("Usage: "); Console.WriteLine(" -> outputs interfaces"); return; } if (args.Length == 0) { Console.WriteLine(MultiplexManager.ListIfs()); return; } int ifIdx = Convert.ToInt32(args[0]); string address = args[1]; int clientPort = Convert.ToInt32(args[2]); int serverPort = Convert.ToInt32(args[3]); MultiplexManager manager = new MultiplexManager(ifIdx, address, clientPort, serverPort); manager.StartServer(); manager.StartClient(); Console.WriteLine("Port proxy läuft. Beliebige Taste drücken um zu beenden..."); Console.ReadKey(); Console.WriteLine("stopping.."); manager.StopServer(); Console.WriteLine("stopped."); _log.Info("PortProxy stopped"); } } }