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 } }
protected override void AcceptClient() { while (true) { tcpClient = TcpListener.AcceptTcpClient(); networkStream = tcpClient.GetStream(); TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission); transmissionDelegate.BeginInvoke(networkStream, TransmissionCallback, tcpClient); } }
public override void AcceptClient() { while (true) { TcpClient tcpClient = _tcpListener.AcceptTcpClient(); _stream = tcpClient.GetStream(); TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission); transmissionDelegate.BeginInvoke(_stream, TransmissionCallback, tcpClient); } }
/// <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); } }
public void AcceptClient() { while (true) { TcpClient client = server.AcceptTcpClient(); NetworkStream stream = client.GetStream(); TransmissionDataDelegate transmissionDelegate = new TransmissionDataDelegate(BeginDataTransmission); transmissionDelegate.BeginInvoke(stream, Callback, client); } }
/// <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()); } }
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); } }
/// <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); } }