?
Solved

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

Posted on 2004-11-16
13
Medium Priority
?
286 Views
Last Modified: 2008-02-01
Is there a work around to an InputStream.read block when no data is available?
0
Comment
Question by:scottd78
  • 7
  • 5
13 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 12595744
Use non-blocking io
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12595775
What exactly is it you're doing?
0
 

Author Comment

by:scottd78
ID: 12595792
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:kiranhk
ID: 12595858
check this out for Non-blocking IO API

http://www.eecs.harvard.edu/~mdw/proj/java-nbio/
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12595868
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?
0
 

Author Comment

by:scottd78
ID: 12595896
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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12596142
>>The ls command on the server can be deleted by people

How? The ls command is integral to ftp and the os
0
 

Author Comment

by:scottd78
ID: 12596672
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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12596735
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
0
 

Author Comment

by:scottd78
ID: 12596761
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.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 1500 total points
ID: 12596829
If that's what they've done, then there's nothing you can do to list it. You could download it again and compare it to what you uploaded to be certain
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12597784
8-)
0
 

Author Comment

by:scottd78
ID: 12597803
I hope no one yells at me now!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month17 days, 8 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question