java.net.BindException: Cannot assign requested address: connect

报错语句:
Socket socket = new Socket("127.0.0.1", 8092, InetAddress.getLocalHost(), 20001);


修改为下面语句后正常:
Socket socket = new Socket(InetAddress.getLocalHost(), 8092, InetAddress.getLocalHost(), 20001);

 

posted @ 2020-08-23 18:20  Numerz  阅读(577)  评论(0编辑  收藏  举报