Client, Server, Testapplication RRS feed

  • Question

  • Hi,
    I read this article.

    I am looking for a client - server implementation WPF App.
    There are so many variations and it is so difficult.


    //if (!TClient.ConnectAsync(IP, Port).Wait(1000))
    TcpClient client = new TcpClient();
    ipAddress = IPAddress.Parse("");
    await client.ConnectAsync(ipAddress, port); // connect to the server
    NetworkStream networkStream = client.GetStream();
    StreamWriter writer = new StreamWriter(networkStream);
    StreamReader reader = new StreamReader(networkStream);
    writer.AutoFlush = true;
    string requestData = "method=" + method + "&" + "data=" + data + "&eor"; // 'end-of-requet'
    await writer.WriteLineAsync(requestData);
    string response = await reader.ReadLineAsync();
    // ------------------------------------------------------

    Client    Server
    I am looking for a client - server implementation
    Similar as a chat.

    Client -> Server
    Server -> Client

    If the server loses the connection, the client must be informed.
    --> Like some kind of full duplex.

    Problems, questions
      How I can do it?
      If no answer is given to a request, timeout after 2000ms
      The end character is not carriage return linefeed, but only \n
         In this case I can't use this ReadLineAsync
      It would be so nice if you could give me a sample
    With best regards Markus
    Saturday, December 16, 2017 1:16 PM