socket客户端连接问题?

  • 项目使用的是Spring-boot
  • 服务器使用的是Centos7,项目部署在Docker中

问题:现在我在项目中使用了socket,设置端口号8089,现在客户端无法连接上,端口已经打开了,并且docker中做了端口映射,但是客户端还是无法连接...??

 

复制代码
 1 /$ netstat -ntlp
 2 Active Internet connections (only servers)
 3 Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
 4 tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1411/sshd           
 5 tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2351/master         
 6 tcp6       0      0 :::3306                 :::*                    LISTEN      11457/docker-proxy  
 7 tcp6       0      0 :::6379                 :::*                    LISTEN      11680/docker-proxy  
 8 tcp6       0      0 :::8080                 :::*                    LISTEN      14386/docker-proxy  
 9 tcp6       0      0 :::80                   :::*                    LISTEN      11748/docker-proxy  
10 tcp6       0      0 :::22                   :::*                    LISTEN      1411/sshd           
11 tcp6       0      0 :::8089                 :::*                    LISTEN      14377/docker-proxy  
12 tcp6       0      0 ::1:25                  :::*                    LISTEN      2351/master
复制代码
0.0.0.0:8080->8080/tcp, 0.0.0.0:8089->8089/tcp
复制代码
Exception in thread "main" 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:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:211)
    at socketTest.Test.main(Test.java:15)
复制代码
白衣染霜花
浏览 475回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java