M
Manfred Denzer
Hello!
I have a Sockt-Connection:
TcpClient socket = new TcpClient();
socket.Connect(this.address, this.port);
Stream inOut = socket.GetStream();
StreamReader sr = new StreamReader(inOut);
I use "ReadToEnd" to read from the Stream:
String receive = sr.ReadToEnd();
But if the remote station doesn't write something in the stream,
"ReadToEnd" is waiting infinitely. How can I cancel the StreamReader
after some seconds/milliseconds? Or can I set a Timeout that the
StreamReader cancel automatically?
Thank you very much for your help!
Manfred Denzer
I have a Sockt-Connection:
TcpClient socket = new TcpClient();
socket.Connect(this.address, this.port);
Stream inOut = socket.GetStream();
StreamReader sr = new StreamReader(inOut);
I use "ReadToEnd" to read from the Stream:
String receive = sr.ReadToEnd();
But if the remote station doesn't write something in the stream,
"ReadToEnd" is waiting infinitely. How can I cancel the StreamReader
after some seconds/milliseconds? Or can I set a Timeout that the
StreamReader cancel automatically?
Thank you very much for your help!
Manfred Denzer