public ProfileFeature( ServerNodeBase network, ServerSettings nodeSettings, ILoggerFactory loggerFactory, DatabaseSettings databaseSettings, X42ClientSettings x42ClientSettings, IxServerLifetime serverLifetime, IAsyncLoopFactory asyncLoopFactory, X42ClientFeature x42FullNode, DatabaseFeatures database, NetworkFeatures networkFeatures, XServer xServer ) { this.network = network; this.nodeSettings = nodeSettings; logger = loggerFactory.CreateLogger(GetType().FullName); this.databaseSettings = databaseSettings; this.serverLifetime = serverLifetime; this.asyncLoopFactory = asyncLoopFactory; this.x42ClientSettings = x42ClientSettings; this.x42FullNode = x42FullNode; this.database = database; this.networkFeatures = networkFeatures; this.xServer = xServer; x42Client = new X42Node(x42ClientSettings.Name, x42ClientSettings.Address, x42ClientSettings.Port, logger, serverLifetime, asyncLoopFactory, false); }
private void OnLoginGameClick(GameObject go) { GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK); XServer node = LoginModule.Instance.GetCurrServer(); LoginService.Instance.TrySelectServer(node == null ? 0 : node.ID); }
/// <summary> /// Stops listening for client connections /// </summary> public void Stop() { _mreIsListening?.Dispose(); _mreIsListening = null; _host?.Stop(); _host = null; }
public void SetCurrServer(ClientServerNode server) { m_CurrServer = new XServer(); m_CurrServer.ID = server.SvrID; m_CurrServer.Name = server.SvrName; m_CurrServer.State = (int)server.SvrState; }
private static void Main(string[] args) { // TODO: Arguments! Console.Title = "Xbox Live Machine Account Creation Server"; Resources.Start(); XServer server = new XServer(); server.Start(); Thread.Sleep(-1); //while (true) //{ // IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 88); // byte[] data = udpServer.Receive(ref remoteEP); // Console.WriteLine("Received " + data.Length + " bytes from " + remoteEP); // Console.WriteLine("Data: " + BitConverter.ToString(data).Replace("-", "")); // // First Request is AS_REQ // data = AsnIO.FindBER(data); // AsnElt AS_REQ = AsnElt.Decode(data); // AsnElt[] KDC_REQ = AS_REQ.Sub[0].Sub; // foreach (AsnElt s in KDC_REQ) // { // switch (s.TagValue) // { // case 1: // Console.WriteLine("PVNO: " + s.Sub[0].GetInteger()); // break; // case 2: // Console.WriteLine("MSG TYPE: " + s.Sub[0].GetInteger()); // break; // case 3: // Console.WriteLine("PA DATA"); // foreach (AsnElt pa in s.Sub[0].Sub) // { // Console.WriteLine(pa); // } // break; // case 4: // // break; // default: // throw new Exception("Invalid tag AS_REQ value: " + s.TagValue); // break; // } // } //} }
public static void Main(string[] args) { TestXServerOptions opts = new TestXServerOptions(args); string[] dpy = opts.RemainingArguments; XServer xs = new XServer(); xs.InitUnix(); }
/// <summary> /// Starts listening for client connections on the specified network interface and port /// </summary> /// <param name="ipAddress">The IP address on which to bind and listen for clients</param> /// <param name="port">The port on which to listen. Must be a positive value.</param> public void Start(IPAddress ipAddress, int port) { if (port <= 0) { throw new ArgumentOutOfRangeException(nameof(port)); } Stop(); _mreIsListening = new ManualResetEventSlim(false); _host = new XServer <XClient <Message> >(); _host.IsListeningChanged += (isListening) => { IsListeningChanged?.Invoke(isListening); _mreIsListening?.Set(); }; _host.ClientConnected += (client) => { client.Socket.UseCompression = true; //Log.i("Client Connected: {0}", client.Name); client.Disconnected += (c, remoteEndPoint, exception) => { //var name = (c as GenericClient<Message>)?.Socket.Name ?? "Unknown"; Log.i($"Client Disconnected: {remoteEndPoint.ToString()}"); }; client.MessageReceived += (c, message) => { try { //call the appropriate RPC method OnMessageReceived(ref message); try { //Put this in a task to multi-thread the encryption and compression //Task.Run(() => //{ //send the result back to the client c.SerializationSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; c.SerializationSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None; c.Send(message); //}); } catch (Exception e) { Log.e(e); } } catch (Exception e) { Log.e(e); } }; }; _host.Start(ipAddress, port); }
public ApiFeature( IServerBuilder xServerBuilder, XServer xServer, ApiFeatureOptions apiFeatureOptions, ApiSettings apiSettings, ILoggerFactory loggerFactory, ICertificateStore certificateStore) { serverBuilder = xServerBuilder; this.xServer = xServer; this.apiFeatureOptions = apiFeatureOptions; this.apiSettings = apiSettings; this.certificateStore = certificateStore; logger = loggerFactory.CreateLogger(GetType().FullName); }
public BaseFeature(ServerSettings serverSettings, DataFolder dataFolder, IxServerLifetime serverLifetime, IDateTimeProvider dateTimeProvider, IAsyncLoopFactory asyncLoopFactory, ILoggerFactory loggerFactory, XServer network) { this.serverSettings = Guard.NotNull(serverSettings, nameof(serverSettings)); this.dataFolder = Guard.NotNull(dataFolder, nameof(dataFolder)); this.serverLifetime = Guard.NotNull(serverLifetime, nameof(serverLifetime)); this.network = network; this.dateTimeProvider = dateTimeProvider; this.asyncLoopFactory = asyncLoopFactory; this.loggerFactory = loggerFactory; logger = loggerFactory.CreateLogger(GetType().FullName); }
public PriceFeature( ServerNodeBase network, ILoggerFactory loggerFactory, DatabaseSettings databaseSettings, IxServerLifetime serverLifetime, IAsyncLoopFactory asyncLoopFactory, DatabaseFeatures database, NetworkFeatures networkFeatures, XServer xServer ) { this.network = network; logger = loggerFactory.CreateLogger(GetType().FullName); this.databaseSettings = databaseSettings; this.serverLifetime = serverLifetime; this.asyncLoopFactory = asyncLoopFactory; this.database = database; this.networkFeatures = networkFeatures; this.xServer = xServer; }
public static IWebHost Initialize(IEnumerable <ServiceDescriptor> services, XServer xServer, ApiSettings apiSettings, ICertificateStore store, IWebHostBuilder webHostBuilder) { Guard.NotNull(xServer, nameof(xServer)); Guard.NotNull(webHostBuilder, nameof(webHostBuilder)); Uri apiUri = apiSettings.ApiUri; X509Certificate2 certificate = apiSettings.UseHttps ? GetHttpsCertificate(apiSettings.HttpsCertificateFilePath, store) : null; webHostBuilder .UseKestrel(options => { if (!apiSettings.UseHttps) { return; } Action <ListenOptions> configureListener = listenOptions => { listenOptions.UseHttps(certificate); }; IPAddress[] ipAddresses = Dns.GetHostAddresses(apiSettings.ApiUri.DnsSafeHost); foreach (IPAddress ipAddress in ipAddresses) { options.Listen(ipAddress, apiSettings.ApiPort, configureListener); } }) .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseUrls(apiUri.ToString()) .ConfigureServices(collection => { if (services == null) { return; } // copies all the services defined for the xServer to the Api. // also copies over singleton instances already defined foreach (ServiceDescriptor service in services) { object obj = xServer.Services.ServiceProvider.GetService(service.ServiceType); if (obj != null && service.Lifetime == ServiceLifetime.Singleton && service.ImplementationInstance == null) { collection.AddSingleton(service.ServiceType, obj); } else { collection.Add(service); } } }) .UseStartup <ApiBuilder>(); IWebHost host = webHostBuilder.Build(); host.Start(); return(host); }
public PublicController(XServer xServer, ProfileFeature profileFeature, PriceFeature priceFeature) { this.xServer = xServer; this.profileFeature = profileFeature; this.priceFeature = priceFeature; }
public void ShowCurrServer() { XServer data = LoginModule.Instance.GetCurrServer(); curServerName.text = data == null ? "服务器" : data.Name; }