Hi,
I have a Client-Server program in C#.
Here is the Server's code:
...
String dataFromClient = "";
NetworkStream networkStream;
TcpClient clientSocket;
bool transfer = true;
...
while (transfer)
{
networkStream = clientSocket.GetStream();
networkStream.Read(bytesFrom, 0, (int)clientSocket.ReceiveBufferSize);
dataFromClient = System.Text.Encoding.ASCII.GetString(bytesFrom);
dataFromClient = dataFromClient.Substring(0, dataFromClient.IndexOf("$"));
....
}
I want to make a condition that stop the loop when the Client is disconnected.
How can I do that?
Many thanks,