Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发送电子邮件时,ping smtp.gmail.com和java程序的命令提示符中获取请求超时_Java_Email - Fatal编程技术网

发送电子邮件时,ping smtp.gmail.com和java程序的命令提示符中获取请求超时

发送电子邮件时,ping smtp.gmail.com和java程序的命令提示符中获取请求超时,java,email,Java,Email,需要通过java程序发送邮件,一旦我在另一台机器上成功运行了我的程序,据我所知,程序是正确的,但这次它显示了超时连接,当我在命令提示符下检查时,它也显示了请求超时 对于命令提示: C:>ping smtp.gmail.com ping gmail-smtp-msa.l.google.com[74.125.69.108]和32字节的数据: Request timed out. Request timed out. Request timed out. Request timed out. Pin

需要通过java程序发送邮件,一旦我在另一台机器上成功运行了我的程序,据我所知,程序是正确的,但这次它显示了超时连接,当我在命令提示符下检查时,它也显示了请求超时

对于命令提示:

C:>ping smtp.gmail.com

ping gmail-smtp-msa.l.google.com[74.125.69.108]和32字节的数据:

Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping统计数据为74.125.69.109: 数据包:发送=4,接收=0,丢失=4(100%丢失)


对于java程序:

java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

故障排除的第一步是确保您可以在本地ping。 为此:

Go to Start > Run, type cmd and press Enter.
Type ping 127.0.0.1 and press Enter.
If this fails, troubleshoot your firewall.
如果该步骤成功:

Type ping 25.x.x.x where 25.x.x.x is your own hamachi IP.
If this fails, again revisit your firewall settings.
Type ping 25.x.x.x where 25.x.x.x is the IP of the target computer.
If this fails, you'll need to troubleshoot the firewall on that machine.


If you use IPv6 protocol mode, you need to type ping -6 <IPv6 address>. For example, ping -6 2620:9b::586:5b0c
如果成功:

Type ping 25.x.x.x where 25.x.x.x is your own hamachi IP.
If this fails, again revisit your firewall settings.
Type ping 25.x.x.x where 25.x.x.x is the IP of the target computer.
If this fails, you'll need to troubleshoot the firewall on that machine.


If you use IPv6 protocol mode, you need to type ping -6 <IPv6 address>. For example, ping -6 2620:9b::586:5b0c
键入ping 25.x.x.x,其中25.x.x.x是目标计算机的IP。
如果失败,您需要对该计算机上的防火墙进行故障排除。
如果使用IPv6协议模式,则需要键入ping-6。例如,ping-620:9b::586:5b0c

如果上述步骤不起作用,还可以尝试删除默认网关。

可能是防火墙问题。@Jens,请您指导我检查是否确实是防火墙问题。。。