File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes get Firewall configuration in JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "get Firewall configuration in JAVA" Watch "get Firewall configuration in JAVA" New topic
Author

get Firewall configuration in JAVA

Mrutyunjay Hanchinal
Ranch Hand

Joined: Sep 26, 2001
Posts: 50
HI
I am writing a java component that gets some files from a FTP server. If the FTP server is behind the firewall and FTP access is blocked in the forewall then the client needs to be intimated that the firewall is stopping files being downloaded.
So I think before connnecting to FTP server, if I get the info that accessing FTP server is not possible, then I can flash a message saying FTP server is behind the firewall and is not possible to connect.
So how do I go about it?
Thanks
Mrutyunjay
[ March 19, 2002: Message edited by: Mrutyunjay Hanchinal ]
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Moving this to Socket/Internet Protocols.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Hi - Two cases:
1) The wall permits no ftp whatsoever.
You should get the infamous 'connection refused' return when attempting to connect. However, you will get the same if the wall allows ftp but the ftp daemon is not started. I know of no way to tell the difference.
2) The wall allows passive ftp but not active (I hope I got those terms right and not backwards).
What will happen then, is the initial connect will work OK. But when a 'get' request is issued, the ftp daemon will switch modes and hence TCP/IP port numbers, via a negotiation with the client. It is possible to get 'connection refused' at this point! Again no real way to tell if passive/active is the real problem - maybe the daemon just crashed!

In the second case, I usually assume the wall is not configured correctly. However, it may be that a particular system would be configured to not allow 'get' requests, only 'dir' and such. Depends on the SA's objectives.
HTH (and I know it does not much), Good Luck, Guy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get Firewall configuration in JAVA