public override void Connecting(IServer server, ConnectingEventArgs e) { if (server.Count > ServerConfig.MaxConnections) { e.Cancel = true; } }
protected static void OnConnecting(ConnectingEventArgs e) { if (Connecting != null) { Connecting(e); } }
public virtual void Connecting(IServer server, ConnectingEventArgs e) { if (server.EnableLog(LogType.Info)) { server.Log(LogType.Info, null, "connect from {0}", e.Socket.RemoteEndPoint); } }
public override void Connecting(IServer server, ConnectingEventArgs e) { if (server.Count > Options.MaxConnections) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} out of max connections!"); } } IPEndPoint ipPoint = (IPEndPoint)e.Socket.RemoteEndPoint; if (!IPv4Tables.Verify(ipPoint.Address)) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} IPv4 tables verify no permission!"); } } if (Options.IPRpsLimit > 0) { string ip = ((IPEndPoint)e.Socket.RemoteEndPoint).Address.ToString(); var item = mIPLimit.GetItem(ip); if (item != null) { if (!item.Enabled) { e.Cancel = true; } } } HttpConnecting?.Invoke(this, e); e.Socket.NoDelay = true; }
public override void Connecting(IServer server, ConnectingEventArgs e) { if (server.Count > Options.MaxConnections) { e.Cancel = true; } e.Socket.NoDelay = true; }
public override void Connecting(IServer server, ConnectingEventArgs e) { if (server.Count > ServerOptions.MaxConnections) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"XRPC Maximum online limit,{e.Socket.RemoteEndPoint} closed!"); } } }
private async void LobbyClient_Connecting(object sender, ConnectingEventArgs e) { try { OnPropertyChanged(nameof(ConnectionStatus)); await Dispatcher.InvokeAsync(() => { ProfileTab.IsEnabled = false; }); } catch (Exception ex) { Log.Error($"{nameof(LobbyClient_Connecting)}", ex); } }
private void OnConnecting(ConnectingEventArgs e) { try { if (Handler != null) { Handler.Connecting(this, e); } } catch (Exception e_) { Error(e_, null, "Server session connecting process error!"); } }
/// <inheritdoc cref="API.Network.OnConnecting(object, ConnectingEventArgs)"/> public void OnConnecting(object _, ConnectingEventArgs ev) { if (!IPAddress.TryParse(Instance.Config?.Bot?.IPAddress, out IPAddress ipAddress)) { Log.Error($"[NET] {string.Format(Language.InvalidIPAddress, Instance.Config?.Bot?.IPAddress)}"); return; } ev.IPAddress = ipAddress; ev.Port = Instance.Config.Bot.Port; ev.ReconnectionInterval = TimeSpan.FromSeconds(Instance.Config.Bot.ReconnectionInterval); Log.Warn($"[NET] {string.Format(Language.ConnectingTo, ev.IPAddress, ev.Port)}"); }
private void FsUser_Connecting(object sender, ConnectingEventArgs e) { /* * https://www.rebex.net/file-server/features/events.aspx#connecting */ try { var callPath = $"{MethodBase.GetCurrentMethod().DeclaringType.Name}.{MethodBase.GetCurrentMethod().Name}"; Log.Information($"'{callPath}' from {e.ClientEndPoint}"); e.Accept = true; } catch (Exception ex) { Log.Error(ex.ToString()); } }
private async Task Update(CancellationToken cancellationToken) { while (true) { try { ConnectingEventArgs ev = new ConnectingEventArgs(IPEndPoint.Address, (ushort)IPEndPoint.Port, ReconnectionInterval); OnConnecting(this, ev); IPEndPoint.Address = ev.IPAddress; IPEndPoint.Port = ev.Port; ReconnectionInterval = ev.ReconnectionInterval; TcpClient = new TcpClient(); await TcpClient.ConnectAsync(IPEndPoint.Address, IPEndPoint.Port); OnConnected(this, System.EventArgs.Empty); await ReceiveAsync(cancellationToken); } catch (IOException ioException) { OnReceivingError(this, new ReceivingErrorEventArgs(ioException)); } catch (SocketException socketException) when(socketException.ErrorCode == 10061) { OnConnectingError(this, new ConnectingErrorEventArgs(socketException)); } catch (Exception exception) when(exception.GetType() != typeof(OperationCanceledException)) { OnUpdatingConnectionError(this, new UpdatingConnectionErrorEventArgs(exception)); } cancellationToken.ThrowIfCancellationRequested(); await Task.Delay(ReconnectionInterval, cancellationToken); } }
public override void Connecting(IServer server, ConnectingEventArgs e) { if (server.Count > Options.MaxConnections) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} out of max connections!"); } } IPEndPoint ipPoint = (IPEndPoint)e.Socket.RemoteEndPoint; if (!IPv4Tables.Verify(ipPoint.Address)) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} IPv4 tables verify no permission!"); } } e.Socket.NoDelay = true; }
public override void Connecting(IServer server, ConnectingEventArgs e) { Logger.Trace(() => $"远程开始连接:{e.Socket.RemoteEndPoint}"); base.Connecting(server, e); }
/// <summary> /// Called before the network connects to the server. /// </summary> /// <param name="sender">The sender instance.</param> /// <param name="ev">The <see cref="ConnectingEventArgs"/> instance.</param> protected virtual void OnConnecting(object sender, ConnectingEventArgs ev) => Connecting?.Invoke(sender, ev);
public override void Connecting(IServer server, ConnectingEventArgs e) { Console.WriteLine("Connecting"); }
public void Connecting(IServer server, ConnectingEventArgs e) { Loger.Process(LogType.INFO, "connect from {0}", e.Socket.RemoteEndPoint); }
public override void Connecting(IServer server, ConnectingEventArgs e) { }
private static void MServer_Connecting(object sender, ConnectingEventArgs e) { // This test server is only for local access e.Cancel = !IPAddress.IsLoopback((e.Client.Client.RemoteEndPoint as IPEndPoint).Address); }
public void Connecting(IServer server, ConnectingEventArgs e) { }