public CampaignsController(ILoggerFactory loggerFactory, GameService games, IUserService users, ISocketService sockets) { logger = loggerFactory.CreateLogger <CampaignsController>(); this.users = users; this.games = games; this.sockets = sockets; }
public DotNettyServerBootstrap(IOptions <ServerAddress> address, ISocketService service, ITransportMessageCodecFactory codecFactory, ILogger <DotNettyServerBootstrap> logger) { _logger = logger; _address = address; _decoder = codecFactory.CreateDecoder(); _service = service; }
/// <summary> /// new /// </summary> /// <param name="socketService"></param> /// <param name="protocol"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="maxMessageSize"></param> /// <param name="maxConnections"></param> /// <exception cref="ArgumentNullException">socketService is null.</exception> /// <exception cref="ArgumentNullException">protocol is null.</exception> /// <exception cref="ArgumentOutOfRangeException">maxMessageSize</exception> /// <exception cref="ArgumentOutOfRangeException">maxConnections</exception> public SocketServer(ISocketService <TCommandInfo> socketService, Protocol.IProtocol <TCommandInfo> protocol, int socketBufferSize, int messageBufferSize, int maxMessageSize, int maxConnections) : base(socketBufferSize, messageBufferSize) { if (socketService == null) { throw new ArgumentNullException("socketService"); } if (protocol == null) { throw new ArgumentNullException("protocol"); } if (maxMessageSize < 1) { throw new ArgumentOutOfRangeException("maxMessageSize"); } if (maxConnections < 1) { throw new ArgumentOutOfRangeException("maxConnections"); } this._socketService = socketService; this._protocol = protocol; this._maxMessageSize = maxMessageSize; this._maxConnections = maxConnections; }
public CharactersController(GameService games, ILoggerFactory loggerFactory, IUserService users, ISocketService sockets) { this.games = games; this.users = users; this.sockets = sockets; logger = loggerFactory.CreateLogger <CharactersController>(); }
/// <summary> /// 群分组信息查询 /// </summary> public GroupCategoryCommand(byte[] data, ISocketService service, IServerMessageSubject transponder, QQUser user) : base(data, service, transponder, user) { _packet = new Receive_0X0195(data, _user); _eventArgs = new QQEventArgs <Receive_0X0195>(_service, _user, _packet); }
public MainForm(Settings settings, ISocketService socket) { Socket = socket; Settings = settings; InitializeComponent(); // Tray Initialization this.InitTray(notifyIcon1, new Dictionary <string, EventHandler>() { { "Exit", Exit }, { "Show", Show }, { "Go Smoke", SmokeBtn_Click } }); // PopUp Initialization this.InitPopUp(new PopUpNotifierSettings { TitleText = "Hey Buddy ^_^", Duration = 5, OnCloseEvent = PopUp_Close, Size = new Size(new Point(400, 200)) }); // Settings Initialization this.InitSettings(settings); // Socket Initialization this.InitSocket(GoSmoke); InitSettings(settings); }
/// <summary> /// Base creator for BaseSocketConnectionHost. /// </summary> /// <param name="hostType"> /// Host type. /// </param> /// <param name="socketService"> /// Socket service. /// </param> /// <param name="delimiterType"> /// Delimiter type. /// </param> /// <param name="delimiter"> /// Delimiter byte array. /// </param> /// <param name="socketBufferSize"> /// Socket buffer size. /// </param> /// <param name="messageBufferSize"> /// Max message buffer size. /// </param> /// <param name="idleCheckInterval"> /// Idle check interval timeout. /// </param> /// <param name="idleTimeOutValue"> /// Idle connection timeout. /// </param> public BaseSocketConnectionHost(HostType hostType, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int socketBufferSize, int messageBufferSize, int idleCheckInterval, int idleTimeOutValue) { FHostType = hostType; FConnectionId = 1000; FSocketConnectionsSync = new ReaderWriterLock(); FSocketConnections = new Dictionary <long, BaseSocketConnection>(); FSocketCreators = new List <BaseSocketConnectionCreator>(); FSocketService = socketService; FWaitCreatorsDisposing = new ManualResetEvent(false); FWaitConnectionsDisposing = new ManualResetEvent(false); FWaitThreadsDisposing = new ManualResetEvent(false); FIdleCheckInterval = idleCheckInterval; FIdleTimeOutValue = idleTimeOutValue; if ((FIdleCheckInterval > 0) && (FIdleTimeOutValue > 0)) { FIdleTimer = new Timer(new TimerCallback(CheckSocketConnections)); } FDelimiter = delimiter; FDelimiterType = delimiterType; FMessageBufferSize = messageBufferSize; FSocketBufferSize = socketBufferSize; FActive = false; FSyncActive = new Object(); }
public MessageHandler(ISocketService webSocketService) { this.webSocketService = webSocketService; this.webSocketService.OnError += (sender, e) => OnError?.Invoke(sender, e); this.webSocketService.MessageReceived += ParseAndHandleMessage; }
/// <summary> /// new /// </summary> /// <param name="port"></param> /// <param name="socketService"></param> /// <param name="protocol"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="maxMessageSize"></param> /// <param name="maxConnections"></param> /// <exception cref="ArgumentNullException">socketService is null.</exception> /// <exception cref="ArgumentNullException">protocol is null.</exception> /// <exception cref="ArgumentOutOfRangeException">maxMessageSize</exception> /// <exception cref="ArgumentOutOfRangeException">maxConnections</exception> public SocketServer(int port, ISocketService <TMessage> socketService, Protocol.IProtocol <TMessage> protocol, int socketBufferSize, int messageBufferSize, int maxMessageSize, int maxConnections) : base(socketBufferSize, messageBufferSize) { if (socketService == null) { throw new ArgumentNullException("socketService"); } if (protocol == null) { throw new ArgumentNullException("protocol"); } if (maxMessageSize < 1) { throw new ArgumentOutOfRangeException("maxMessageSize"); } if (maxConnections < 1) { throw new ArgumentOutOfRangeException("maxConnections"); } this._socketService = socketService; this._protocol = protocol; this._maxMessageSize = maxMessageSize; this._maxConnections = maxConnections; this._listener = new SocketListener(new IPEndPoint(IPAddress.Any, port), this); this._listener.Accepted += this.OnAccepted; }
public MainPage() { InitializeComponent(); DataContext = this; socketService = new SocketService("http://127.0.0.1:4085"); AttachSocketEvents(socketService); }
public DefaultReceiveCommand(byte[] data, ISocketService service, IServerMessageSubject transponder, QQUser user) : base(data, service, transponder, user) { _packet = new ReceiveCurrency(data, _user); _eventArgs = new QQEventArgs <ReceiveCurrency>(_service, _user, _packet); }
public BaseSocketConnectionHost(HostType hostType, CallbackThreadType callbackThreadtype, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int socketBufferSize, int messageBufferSize, int idleCheckInterval, int idleTimeOutValue) { context = new SocketProviderContext { Active = false, SyncActive = new object(), SocketCreators = new List<BaseSocketConnectionCreator>(), SocketConnections = new Dictionary<long, BaseSocketConnection>(), BufferManager = BufferManager.CreateBufferManager(0, messageBufferSize), SocketService = socketService, IdleCheckInterval = idleCheckInterval, IdleTimeOutValue = idleTimeOutValue, CallbackThreadType = callbackThreadtype, DelimiterType = delimiterType, Delimiter = delimiter, DelimiterEncrypt = new byte[] { 0xFE, 0xDC, 0xBA, 0x98, 0xBA, 0xDC, 0xFE }, MessageBufferSize = messageBufferSize, SocketBufferSize = socketBufferSize, HostType = hostType }; fSocketConnectionsSync = new ReaderWriterLockSlim(); fWaitCreatorsDisposing = new ManualResetEvent(false); fWaitConnectionsDisposing = new ManualResetEvent(false); fWaitThreadsDisposing = new ManualResetEvent(false); }
public CreateAccountPageModel(ISocketService socketService, ILoginCache loginCache) { this.socketService = socketService; this.loginCache = loginCache; credentials = LoadCredentials(); }
public SessionManager(IDependencyManager dependencyManager, ISocketService socketService) { m_DependencyManager = dependencyManager; m_SocketService = socketService; m_Providers = new List <IProvider>(); Sessions = new List <ISession>(); }
public Company GetCompany(string id) { if (socketService == null) { socketService = new SocketService(); } return(socketService.GetCompany(id)); }
public TcpServerChannelHandlerAdapter( ISocketService <TMessage> service, Protocol.IProtocol <TMessage> protocol ) : base(true) { this._service = service; this._protocol = protocol; }
public AmpTcpServerBootstrap( ISocketService <AmpMessage> socketService, IProtocol <AmpMessage> protocol, ILoggerFactory loggerFactory, IOptions <RpcServerOptions> hostOption = null) : base(socketService, protocol, loggerFactory, hostOption) { }
public Company GetCompanyFromUserId(int id) { if (socketService == null) { socketService = new SocketService(); } return(socketService.GetCompanyFromUserId(id)); }
private void SendBroadcast() { ISocketService socketService = Mvx.Resolve <ISocketService>(); IIPAddressManager addressManager = Mvx.Resolve <IIPAddressManager>(); string address = addressManager.GetBroadcastAddress(); socketService.SendBroadcast("Hello", address, 52112); }
public AmpTcpServerBootstrap( ISocketService <AmpMessage> socketService, IChannelHandlerPipeline handlerPipeline, ILoggerFactory loggerFactory, IOptions <RpcServerOptions> hostOption = null) : base(socketService, handlerPipeline, loggerFactory, hostOption) { }
public void DeleteCompanyWish(int id) { if (socketService == null) { socketService = new SocketService(); } socketService.DeleteCompanyWish(id); }
protected DispatchPacketToCommand(byte[] data, ISocketService service, IServerMessageSubject transponder, QQUser user) { _data = data; _service = service; _transponder = transponder; _user = user; }
public SocketServer(int port, ISocketService service) { IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); ipAddress = ipHostInfo.AddressList[0]; this.service = service; this.port = port; serverSocket = new TcpListener(IPAddress.Any, port); }
public Company UpdateCompany(Company company) { if (socketService == null) { socketService = new SocketService(); } socketService.UpdateCompany(company); return(company); }
public OnkyoApi( ISocketService socketService, IDeviceDiscoveryService deviceDiscoveryService, IPacketService packetService ) { _socketService = socketService; _deviceDiscoveryService = deviceDiscoveryService; _packetService = packetService; }
public string CreateCompany(Company newCompany) { if (socketService == null) { socketService = new SocketService(); } string id = socketService.AddCompany(newCompany); return(id); }
public string CreateUser(User newUser) { if (socketService == null) { socketService = new SocketService(); } string id = socketService.AddUser(newUser); return(id); }
protected override void OnStop() { if (m_SocketService == null) { return; } Console.WriteLine("Shutting down server..."); m_SocketService?.Dispose(); m_SocketService = null; Console.WriteLine("Server shutdown."); }
public MainPageViewModel() { Title = "Scan"; _socketService = DependencyService.Get <ISocketService>(); _socketService.ErrorEvent += OnErrorEvent; _socketService.InfoEvent += OnInfoEvent; _socketService.InChannelStarted += OnInChannelStarted; _socketService.OutChannelStarted += OnOutChannelStarted; MessageEntryStarted += OnMessageEntryStarted; SetupButtonCommands(); }
public MyBenchmarks() { _config = new ServerConfig { BufferSize = 10240, Backlog = 240, IpAddress = "127.0.0.1", Port = 8787, Retry = 3 }; _tcpService = new TcpService(_config); _client = new ClientSocket(); }
public TcpServerBootstrap( ISocketService <TMessage> socketService, IChannelHandlerPipeline handlerPipeline, ILoggerFactory loggerFactory, IOptions <TcpHostOption> hostOption = null ) { Preconditions.CheckNotNull(handlerPipeline, nameof(handlerPipeline)); Preconditions.CheckNotNull(socketService, nameof(socketService)); _options = hostOption?.Value ?? new TcpHostOption(); _socketService = socketService; _handlerPipeline = handlerPipeline; _logger = loggerFactory.CreateLogger(GetType()); }
public ServerSocket() { _innerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _newClientSocketSignal = new ManualResetEvent(false); _socketService = new DefaultSocketService(); }
public BaseSocketConnectionHost(HostType hostType, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter) : this(hostType, CallbackThreadType.ctWorkerThread, socketService, delimiterType, delimiter, 1024, 1024, 1000, 1000) { }
public SocketClient(CallbackThreadType callbackThreadType, ISocketService socketService) : base(HostType.htClient, callbackThreadType, socketService, DelimiterType.dtNone, null, 2048, 2048, 0, 0) { //----- }
public SocketClient(CallbackThreadType callbackThreadType, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter) : base(HostType.htClient, callbackThreadType, socketService, delimiterType, delimiter, 2048, 2048, 0, 0) { //----- }
public BaseSocketConnectionHost(HostType hostType, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int idleCheckInterval, int idleTimeOutValue) : this(hostType, CallbackThreadType.ctWorkerThread, socketService, delimiterType, delimiter, 1024, 1024, idleCheckInterval, idleTimeOutValue) { }
public ClientSocket() { _innerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _socketService = new DefaultSocketService(); }
public SocketServer(CallbackThreadType callbackThreadType, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int socketBufferSize, int messageBufferSize, int idleCheckInterval, int idleTimeOutValue) : base(HostType.htServer, callbackThreadType, socketService, delimiterType, delimiter, socketBufferSize, messageBufferSize, idleCheckInterval, idleTimeOutValue) { //----- }
protected override void Free(bool canAccessFinalizable) { if (FIdleTimer != null) { FIdleTimer.Dispose(); FIdleTimer = null; } if (FWaitCreatorsDisposing != null) { FWaitCreatorsDisposing.Set(); FWaitCreatorsDisposing.Close(); FWaitCreatorsDisposing = null; } if (FWaitConnectionsDisposing != null) { FWaitConnectionsDisposing.Set(); FWaitConnectionsDisposing.Close(); FWaitConnectionsDisposing = null; } if (FWaitThreadsDisposing != null) { FWaitThreadsDisposing.Set(); FWaitThreadsDisposing.Close(); FWaitThreadsDisposing = null; } if (FSocketConnections != null) { FSocketConnections.Clear(); FSocketConnections = null; } if (FSocketCreators != null) { FSocketCreators.Clear(); FSocketCreators = null; } FSocketConnectionsSync = null; FSocketService = null; FDelimiter = null; base.Free(canAccessFinalizable); }
/// <summary> /// Base creator for BaseSocketConnectionHost. /// </summary> /// <param name="hostType"> /// Host type. /// </param> /// <param name="socketService"> /// Socket service. /// </param> /// <param name="delimiterType"> /// Delimiter type. /// </param> /// <param name="delimiter"> /// Delimiter byte array. /// </param> /// <param name="socketBufferSize"> /// Socket buffer size. /// </param> /// <param name="messageBufferSize"> /// Max message buffer size. /// </param> /// <param name="idleCheckInterval"> /// Idle check interval timeout. /// </param> /// <param name="idleTimeOutValue"> /// Idle connection timeout. /// </param> public BaseSocketConnectionHost(HostType hostType, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int socketBufferSize, int messageBufferSize, int idleCheckInterval, int idleTimeOutValue) { FHostType = hostType; FConnectionId = 1000; FSocketConnectionsSync = new ReaderWriterLock(); FSocketConnections = new Dictionary<long, BaseSocketConnection>(); FSocketCreators = new List<BaseSocketConnectionCreator>(); FSocketService = socketService; FWaitCreatorsDisposing = new ManualResetEvent(false); FWaitConnectionsDisposing = new ManualResetEvent(false); FWaitThreadsDisposing = new ManualResetEvent(false); FIdleCheckInterval = idleCheckInterval; FIdleTimeOutValue = idleTimeOutValue; if ( (FIdleCheckInterval > 0) && (FIdleTimeOutValue > 0) ) { FIdleTimer = new Timer(new TimerCallback(CheckSocketConnections)); } FDelimiter = delimiter; FDelimiterType = delimiterType; FMessageBufferSize = messageBufferSize; FSocketBufferSize = socketBufferSize; FActive = false; FSyncActive = new Object(); }
public SocketServer(ISocketService socketService) : base(HostType.htServer, socketService, DelimiterType.dtNone, null, 4096, 8192, 0, 0) { //----- }
public SocketClient(ISocketService socketService) : base(HostType.htClient, socketService, DelimiterType.dtNone, null, 2048, 8192, 0, 0) { //----- }
public SocketClient(ISocketService socketService, DelimiterType delimiterType, byte[] delimiter) : base(HostType.htClient, socketService, delimiterType, delimiter, 2048, 8192, 0, 0) { //----- }
public SocketClient(ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int socketBufferSize, int messageBufferSize) : base(HostType.htClient, socketService, delimiterType, delimiter, socketBufferSize, messageBufferSize, 0, 0) { //----- }
public SocketClient(ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int socketBufferSize, int messageBufferSize, int idleCheckInterval, int idleTimeOutValue) : base(HostType.htClient, socketService, delimiterType, delimiter, socketBufferSize, messageBufferSize, idleCheckInterval, idleTimeOutValue) { //----- }
public SocketServer(CallbackThreadType callbackThreadType, ISocketService socketService, DelimiterType delimiterType, byte[] delimiter, int socketBufferSize, int messageBufferSize) : base(HostType.htServer, callbackThreadType, socketService, delimiterType, delimiter, socketBufferSize, messageBufferSize, 0, 0) { //----- }
public SocketServer(ISocketService socketService, DelimiterType delimiterType, byte[] delimiter) : base(HostType.htServer, socketService, delimiterType, delimiter, 4096, 8192, 0, 0) { //----- }