I've got a computer behind ForeFront TMG 7.0 and a public remote FTP server. TMG client is installed. Windows firewall is off. Antivirus: McAfee virus scan Enterprise (8.8) + AntySpyware Enterprize (8.8) + No add-ons. Antivirus was tested on and off.
It fails to connect to the server via Java and Php. Filezilla, explorer.exe and Go-written program connects without problems.
For Java I get ConnectionRefused error:
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:182)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:203)
No matter how I'm trying to connect via Java:
Semetimes it trows connection timeout after 5 minutes of waiting. And the error is timeout exception. All varians are tested with direct connection, global proxy, ftp proxy, http proxy and all combinations of that. All variants are tested both by IP and hostname.
Php-code sample that can not connect too:
<?php
$host = "ftphost";
$connect = ftp_connect($host,21);
if(!$connect)
{
echo("Error: $host");
exit;
}
else
{
echo("Cheers: $host");
}
?>
But FileZilla connects without a problem. Explorer connects without a problem. The Go-written program connects without a problem.
Any ideas what can block java and PHP? How can I figure out the policy or the program settings that are blocking JRE and Apache?
You can try to debug the issue with PHP script like below:
<?php
$host = "xx.xx.xx.xx";
$ftpUser = "annonymous";
$ftpPass = null;
$checkPort = @fsockopen($host, 21, $errno, $errstr, 10);
if($checkPort!==false){
echo "can able to connect ftp server";
$conn_id = ftp_connect($host);
if($conn_id!==false){
echo "\n Ftp server available and connected trying to logged in";
$loginStatus = ftp_login($conn_id, $ftpUser, $ftpPass);
if($loginStatus!==false){
echo "\n Connected to ftp";
} else {
echo "\n Please check credentials";
}
}
} else {
echo "server can't reach to ftp server";
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With