How to send multiple messages over a socket
<p>I saw on the internet how to create a socket server in C#,<br>
after sending to the server one message the server closes.<br>
I have been wondering what can I do to change it so it can handle multiple messages.</p>

<p>The code:</p>

<pre><code>static void startServer() {
    Console.WriteLine("[*] Opening server...");
    TcpListener listener = new TcpListener(IPAddress.Any, 45784);
    listener.Start();
    Console.WriteLine("[*] Server waiting on port " + 45784);
    TcpClient client = listener.AcceptTcpClient();
    Console.WriteLine("Client connected!");

    StreamReader STR = new StreamReader(client.GetStream());
    Console.WriteLine(STR.ReadLine());
}
static void Main(string[] args)
    {
        string ip = GetIpAdress();
        Console.WriteLine("server on: " + ip);
        startServer();
        Console.Read();
    }
</code></pre>