dcsimg
How can I access a remote file?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Richard_Brochu
Posted On:   Tuesday, October 21, 2003 05:59 AM

I would like to access a file on a remote host. I have access to the host file using a network path such as "\hostpathfile". I do: File theFile = new File("\\host\path\file"); if(theFile.exists()) { ... } In some tests this works. In others, it doesn't. The file exists in the proper location. I can access it through a DOS window using "type \hostpathfile". If I remove the .exists() call and do try/catch with file manipulation, it says something about "FileNotFoundException: Logon failure: unknown user name or bad password". I guess this problem is network related. I noticed that if I comment out a section of code that opens and closes two sockets to   More>>

I would like to access a file on a remote host. I have access to the host file using a network path such as "\hostpathfile". I do:

			
File theFile = new File("\\host\path\file");
if(theFile.exists()) {
...
}





In some tests this works. In others, it doesn't. The file exists in the proper location. I can access it through a DOS window using "type \hostpathfile". If I remove the .exists() call and do try/catch with file manipulation, it says something about "FileNotFoundException: Logon failure: unknown user name or bad password". I guess this problem is network related. I noticed that if I comment out a section of code that opens and closes two sockets to the host before the code shown above that it works every time.



The host is Red Hat 6.1. The client is Windows 2000. Is there any known problems related to this? Can the use of sockets be affecting the subsequent file access (the sockets are closed beforehand)? Do you have any other suggestions to make sure this works properly? I can use FTP but would rather not.



Thanks in advance.    <<Less

Re: How can I access a remote file?

Posted By:   Steven_Martin  
Posted On:   Tuesday, October 21, 2003 09:02 AM

You need to have this as a mounted drive. You would then be able to access it by x:/file/go

That also removes your program having to know what machine it's requesting.
About | Sitemap | Contact