Hello,
Does anyone have any experience using the ReadByte method on a TCP/IP client stream? The method does not return a -1 when I am at the end of a stream, the code just hangs.
Regards,
Dave
Hello,
Does anyone have any experience using the ReadByte method on a TCP/IP client stream? The method does not return a -1 when I am at the end of a stream, the code just hangs.
Regards,
Dave
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
DavidPosted Mar 13, 2008, 12:52 PM
Hello,
Thanks for getting back to me. You are correct, using a try,catch block will work, but it is a "work around" for the problem. I am disappointed when thsings do not work as documented. In theory, if there is nothing in the stream you should receive a -1, otherwise you get the char from the stream.
However, in the real world if there is nothing in the stream you get a exception, which requires you to use a try,catch block as a work around. Well, at leastI have found a way to get the code to work and I can move on to other things that my code needs to do.
Regards,
Dave
Mykel StonePosted Mar 7, 2008, 12:54 PM