Пример #1
0
        protected virtual void OnRaiseClientConnectedEvent(ClientConnectedEventArgs e)
        {
            EventHandler <ClientConnectedEventArgs> handler = RaiseClientConnectedEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #2
0
        private async void AcceptClients()
        {
            while (isRunning)
            {
                Client tempClient = new Client();
                var    client     = await mListener.AcceptTcpClientAsync();

                tempClient.client = client;
                mClients.Add(tempClient);

                logger.Log(LogLevel.Info, string.Format("İstemci başarılı bir şekilde bağlandı. Sayısı {0} - Ip Adresi : {1}", mClients.Count, client.Client.RemoteEndPoint));
                // Client Bağlantı Eventi
                ClientConnectedEventArgs eaClientConnected;
                eaClientConnected = new ClientConnectedEventArgs(client.Client.RemoteEndPoint.ToString());
                OnRaiseClientConnectedEvent(eaClientConnected);
                Send(client, PackageType.Header);
                Send(client, Headers.Authorization);
                Listening(client);
            }
        }