Link to home
Start Free TrialLog in
Avatar of scottd78
scottd78

asked on

Is there a work around to an InputStream.read block when no data is available?

Is there a work around to an InputStream.read block when no data is available?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Use non-blocking io
What exactly is it you're doing?
Avatar of scottd78
scottd78

ASKER

can you give me more detail on how to use non-blocking io?

I'm sending ftp commands over a socket using inputstreams and reading the server output.  Running into issues when something goes wrong with the FTP server and it doesn't respond.
check this out for Non-blocking IO API

http://www.eecs.harvard.edu/~mdw/proj/java-nbio/
It's more likely that the fault is with what you're sending the server. Once you've connected successfully, there is seldom much reason that anything will 'go wrong' on the server side such that you're going to get a blocked read. Can you be more specific about when this is happening?
The ls command on the server can be deleted by people who have to have access to it, so if that gets deleted and I try to LIST, the server hangs.
>>The ls command on the server can be deleted by people

How? The ls command is integral to ftp and the os
I'm not very familiar with how they have the FTP setup but this is what I do know.  Each FTP users root directory has a /bin directory that includes their own ls binary.  I'm guessing they don't want to give permissions to the /bin/ls command for security reasons.
Why would they allow access to a directory by ftp then refuse to list it? However this is being done, (a file permission blunder disallowing listing is also possible) then you should do the same - disallow the use of the list command by your program
They don't disallow listing ... its when someone deletes that ls command I have a problem.  I need to do an ls to verify the complete file has been transferred sucessfully.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
8-)
I hope no one yells at me now!