public MarsNATRPServerConnection(MarsNATRPServerCore server, Socket client, string clientip, ushort clientport) { this.Server = server; this.Client = client; this.clientip = clientip; this.clientport = clientport; }
static void Main(string[] args) { ConsoleColor cfc = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Welcome to use MarsNATRP_Server V1.0.1"); Console.WriteLine("Copyright (c) 2018 GhostFamilyStudio. All rights reserved."); Console.WriteLine("For more information please visit http://ghofamily.sctstu.com"); Console.ForegroundColor = ConsoleColor.Cyan; try { MarsNATRPServerCore server = new MarsNATRPServerCore(args[0], Convert.ToUInt16(args[1]), args[2], Convert.ToUInt16(args[3])); Console.WriteLine("Public bind IP:{0}\r\nPublic bind port:{1}\r\nPrivate bind IP:{2}\r\nPriavte bind port:{3}", args[0], args[1], args[2], args[3]); server.LogWatcher = Console.Out; server.StartServer(); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ForegroundColor = cfc; }
public static void DoRequest(MarsNATRPServerCore server, Socket client, string clientip, ushort clientport) { MarsNATRPServerConnection connection = new MarsNATRPServerConnection(server, client, clientip, clientport); ThreadPool.QueueUserWorkItem(new WaitCallback(connection.DoRequest)); }