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.
Mykel Stone10 pointsPosted Mar 7, 2008, 7:54 AM EST
David4 pointsPosted Mar 13, 2008, 8:52 AM EDT
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