I'm writing a client-server utility application. They communicate through `TcpClient`/`Stream` (client) and `TcpListener`/`Socket` (server). I send bytes back and forth between these two, then I come to the part where I have a problem; the client sends a signal to the server (say `StartCounting`). The client starts doing some stuff (say counts up from zero). The server does the same as soon as it receives the `StartCounting`. Now, while both sides are counting, each side may interrupt the counting (say by pressing return). When one side stops, it sends a message to the other side to stop. Here's some attempted code (for the client, but the only difference is how they read the byte array):

```
private void WaitForBye(object source, ElapsedEventArgs e)
{
    byte[] responseBytes = new byte[1000]; 
    int k = stream.Read(responseBytes, 0, 1000);
    String response = ASCIIEncoding.ASCII.GetString(responseBytes);
    response = response.Substring(0, k);

    String from, to, message;

    extractData(response, out message, out from, out to);

    Console.WriteLine(++counter);
    if (message == "BYE")
        isBye = true;
}

bTimer = new Timer();
bTimer.Elapsed += new ElapsedEventHandler(WaitForBye);
bTimer.Interval = 1000;
bTimer.Enabled = true;

Console.WriteLine("Press return when finished.");
while (Console.ReadLine() != "" && !isBye) ;

```

How would I do that? Preferably without using threads and with a `Timer` instead.