- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我一直遇到这个错误:“新 ServerSocket 上的异常:java.net.BindException:无法分配请求的地址:JVM_Bind”。我尝试使用 netstat 来确保端口(1500)上没有任何东西正在运行。有什么建议吗?
package server;
import java.io.IOException
import java.net.InetAddress
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
public class Server
{
private ServerSocket serverSocket;
Server(int Port)
{
/* create socket server and wait for connection requests */
try
{
serverSocket = new ServerSocket(1500, 0, InetAddress.getByName("69.61.210.196"));
System.out.println("Server waiting for client on port " + serverSocket.getLocalPort());
while(true)
{
Socket socket = serverSocket.accept(); // accept connection
System.out.println("New client asked for a connection");
}
}
catch (IOException e)
{
System.out.println("Exception on new ServerSocket: " + e);
}
}
public static void main(String[] args)
{
new Server(1500);
}
}
最佳答案
听起来您尝试绑定(bind)的IP地址是您网络的外部IP地址,而不是您的机器IP。
建议尝试绑定(bind)到 127.0.0.1
或 0.0.0.0
。
在 Windows ipconfig
和 Linux ifconfig
上通过命令行获取计算机的 IP 使用情况。
关于java.net.BindException :JVM Bind,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12886765/
我已经在 JBoss Fuse 服务器中部署了一些 jar,它在端口 9001 和 9002 上公开了两个 rest 端点。现在我对源代码进行了一些更改,并想部署一个新的 jar。因为我正在进行热
我希望我的客户端应用程序能够连接到服务器应用程序。 问题是我的客户端不知道服务器 IP(在 LAN 中)。 所以我尝试使用java对象MulticastSocket。幸运的是,Oracle 有一个页面
我有 3 个服务器,我在这些服务器中运行以下代码。然而其中之一给出了错误: Exception in thread "main" java.net.BindException: Address alr
通过 java 发出出站请求时(使用 apache.commons.httpclient ),我得到 Permission denied 。以下是 jboss 日志中的根本原因: Caused by:
我正在尝试启动我的 elasticsearch 节点,但出现以下错误 Exception in thread "main" BindTransportException[Failed to bind
我的 serverThreadProc() 方法有问题。每当我运行它时,它都会抛出一个 BindException。认为 try block 的前两行可能存在问题。不知道我做错了什么。 private
当获得BindException时,有没有办法知道使用哪个端口?似乎表明有一个端口已被使用,但不知道是哪个端口。这对于加快调试速度很有用。 最佳答案 当您的程序尝试绑定(bind)到已在使用的端口时,
当我在输入字段中输入诸如“adsf”之类的字母时,spring 尝试将其绑定(bind)到“Code”对象的价格( double )属性,这会导致绑定(bind)异常。如果我想将该字段保留为 doub
我需要一些帮助,我想我遇到了一个简单的网络相关问题。通过了解没有被 .close() 处理的内容,它也将帮助我更好地理解所有这些是如何工作的。我敢肯定这很简单,但对我来说这一切都是全新的。这是客户端程
我理解为什么会发生绑定(bind)错误,但我已按照我能找到的任何解决方案进行操作,但无法使其正常工作。 堆栈跟踪 java.net.BindException: Address already in
向addUser Controller 提交表单时发生异常 SEVERE: Servlet.service() for servlet dispatcherServlet threw exceptio
我正在使用DIY catridge将uaa(https://github.com/cloudfoundry/uaa)部署到Openshift。在执行gradlew run时,出现以下错误: remot
我有一个带有发布请求的 Controller 。我正在尝试使用简单的 NotNull 注释来验证 POJO。我正在使用 ControllerAdvice 来处理异常。 @PostMapping("/s
我有一个带有发布请求的 Controller 。我正在尝试使用简单的 NotNull 注释来验证 POJO。我正在使用 ControllerAdvice 来处理异常。 @PostMapping("/s
我是套接字编程的新手,只是尝试编写一个小程序来了解套接字的工作原理。有一个客户端和一个服务器,我只是尝试从服务器加载一些字符串并显示。但是每次我创建一个服务器套接字时,即使我手动清理了finally
尝试在 openfire 中定义数据库设置时,出现以下错误(正如我在 error.log 文件中看到的那样) 2013.08.14 11:00:23 org.jivesoftware.openfire
我在运行 gwt 应用程序时遇到以下错误。 java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind(Na
我的网络有问题... protected Void doInBackground(Void... arg0) { int nreq = 1; Syste
我一直遇到这个错误:“新 ServerSocket 上的异常:java.net.BindException:无法分配请求的地址:JVM_Bind”。我尝试使用 netstat 来确保端口(1500)上
我在使用 Android 时看到了几个关于 SocketException 的问题,但没有一个问题涉及我在 list 中指定的 INTERNET 权限下得到的 BindException。 这是我的
我是一名优秀的程序员,十分优秀!