I am the first time on the forum and I am having a problem with retrieving the data from the InputStream. I have a Client program that sends the data to the ISeries Server and get a response and display it on a Web page. The problem is that when I run the program interactively, the available method returns zero, but when run in a debug mode, the available() returns the expected number of bytes. Can someone help me in explaining why the method would work only in a debug mode. Below is the source code used to read the data from the socket.
Please let me know if you need more information regarding this.
Probably, in debug mode your code is running more slowly (especially if it's waiting for you to press buttons to step through something) and thus, whatever process is responsible for making bytes available has more time to achieve this. When you're not in debug mode, the code runs faster, and it goes through that code before bytes are actually available. Avoid using available(); it's fundamentally useless.
Joined: Oct 20, 2010
I changed the code not to use the available(), and I'm glad to tell you that it's working perfectly.