예제 #1
0
        protected override void AcceptClient()

        {
            while (true)

            {
                TcpClient tcpClient = TcpListener.AcceptTcpClient();

                Stream = tcpClient.GetStream();

                TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission);

                //callback style

                transmissionDelegate.BeginInvoke(Stream, TransmissionCallback, tcpClient);

                // async result style

                //IAsyncResult result = transmissionDelegate.BeginInvoke(Stream, null, null);

                ////operacje......

                //while (!result.IsCompleted) ;

                ////sprzątanie
            }
        }
예제 #2
0
 protected override void AcceptClient()
 {
     while (true)
     {
         tcpClient     = TcpListener.AcceptTcpClient();
         networkStream = tcpClient.GetStream();
         TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission);
         transmissionDelegate.BeginInvoke(networkStream, TransmissionCallback, tcpClient);
     }
 }
예제 #3
0
 public override void AcceptClient()
 {
     while (true)
     {
         TcpClient tcpClient = _tcpListener.AcceptTcpClient();
         _stream = tcpClient.GetStream();
         TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission);
         transmissionDelegate.BeginInvoke(_stream, TransmissionCallback, tcpClient);
     }
 }
예제 #4
0
 /// <summary>
 /// Tworzenie wątku dla łączącego się klienta.
 /// </summary>
 public void AcceptClient()
 {
     while (true)
     {
         TcpClient                client = listener.AcceptTcpClient();
         NetworkStream            stream = client.GetStream();
         TransmissionDataDelegate transmissionDelegate = BeginDataTransmission;
         transmissionDelegate.BeginInvoke(stream, TransmissionCallback, client);
     }
 }
예제 #5
0
    public void AcceptClient()
    {
        while (true)
        {
            TcpClient     client = server.AcceptTcpClient();
            NetworkStream stream = client.GetStream();

            TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission);
            transmissionDelegate.BeginInvoke(stream, Callback, client);
        }
    }
예제 #6
0
        /// <summary>
        /// Funkcja która kończy się dopiero gdy do serwera podepnie się klient
        /// </summary>
        public void WaitForClients()
        {
            while (true)
            {
                listener.Start();
                TcpClient                client = listener.AcceptTcpClient();
                NetworkStream            stream = client.GetStream();
                TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(ServerLoop);

                transmissionDelegate.BeginInvoke(stream, TransmissionCallback, client);
            }
        }
 protected override void AcceptClient()
 {
     while (true)
     {
         TcpClient = TcpListener.AcceptTcpClient();
         Stream    = TcpClient.GetStream();
         TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission);
         transmissionDelegate.BeginInvoke(Stream, ((IPEndPoint)TcpClient.Client.RemoteEndPoint).Address.ToString(), TransmissionCallback, TcpClient);
         Logger.Info?.Invoke($"Nowe przychodzące połączenie");
         //BeginDataTransmission(Stream, ((IPEndPoint)TcpClient.Client.RemoteEndPoint).Address.ToString());
     }
 }
예제 #8
0
        public override void AcceptClient()
        {
            while (true)
            {
                TcpClient client = TCPlisener.AcceptTcpClient();

                Streamer = client.GetStream();

                int buffer_size = client.ReceiveBufferSize;
                TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission);
                transmissionDelegate.BeginInvoke(Streamer, buffer_size, TransmissionCallback, client);
            }
        }
예제 #9
0
        /// <summary>
        /// Metoda potrzebna do utrzymania polaczenia ze wszystkimi klientami
        /// </summary>
        public override void Server()
        {
            tcpServer.Start();

            Console.WriteLine("Czekam na polaczenie...");
            Console.WriteLine("Adres Serwera: " + tcpServer.LocalEndpoint);
            while (true)
            {
                TcpClient tcpClient = tcpServer.AcceptTcpClient();
                TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(LogowanieiRejestracja);
                transmissionDelegate.BeginInvoke(tcpClient, TransmissionCallback, tcpClient);
            }
        }