此错误来自连接到comcast调制解调器的PC。当某人尝试使用Java URL创建出站TCP通道时,端口是否会受到阻碍。 。 。相关的代码是:Java URLConnection错误
URL u = new URL("mailto:[email protected]"); // make a mailto: url
URLConnection c = u.openConnection(); // make its urlconnection
c.connect(); // connect to mail host
catch (Exception e) { // handle any exceptions, print error message
System.err.println(e);
}
控制台返回消息:
连接。超时= -1 java.net.UnknownHostException:mailhost
是否要连接到邮件服务器? – michael667
-1因为没有做你的研究:'mailto:mail @ address.to'本身并不是一个有效的URI,它仅仅表明了如何处理该地址(在这种情况下,打开一个客户端电子邮件应用程序)。 – Bobby
@Bobby检查http://www.docjar.com/html/api/sun/net/www/protocol/mailto/MailToURLConnection.java.html。我很惊讶。 –