Reply to multiple clients using server
<p>Here is the server code i put this under the button click event. How can i do this program is closed after sending  data with one client and restart or refresh again and connect with next client.</p>

<pre><code>string val;
Process[] pname = Process.GetProcessesByName("chrome");
if (pname.Length == 0)
{
    MessageBox.Show("Application is not running");
    val = "Not Running";
}
else
{
    MessageBox.Show("Application is running");
    val = " Running";
}
TcpListener tcpListener = new TcpListener(10);
tcpListener.Start();
Socket socketForClient = tcpListener.AcceptSocket();
if (socketForClient.Connected)
{
    label1.Show();
    label1.Text="Client connected";
    //MessageBox.Show("Client connected");
    NetworkStream networkStream = new NetworkStream(socketForClient);
    System.IO.StreamWriter streamWriter =
        new System.IO.StreamWriter(networkStream);
    System.IO.StreamReader streamReader =
        new System.IO.StreamReader(networkStream);
    string data_var;
    data_var = textBox1.Text;
    string theString =val;
    streamWriter.WriteLine(theString);
    try
    {
        streamWriter.Flush();
        theString = streamReader.ReadLine();
        label1.Text = theString;
        //MessageBox.Show(theString);
        streamReader.Close();
        networkStream.Close();
        streamWriter.Close();
    }
    catch
    {
        label1.Text = "Not flushed";
    }
}
try
{
    socketForClient.Close();
    //MessageBox.Show("Exiting...");
    label1.Text = "EXIT";
    Application.Restart();
}
catch 
{ }
</code></pre>
