最初は、ワイルドカード アドレス 0.0.0.0 でポート 80 を占有していました
。現在、このポート 80 を、172.18.81.56 などの使用可能な IP アドレスの 1 つにバインドしようとしています。
The following exception occurred
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
しかし、Windows サービス (wrapper.exe) から同じコードを実行している間、例外はなく、サーバー ソケットが正常に作成されました。何が問題なのか...
here the piece of code
ServerSocket ss = null;
try
{
serverHost = "172.18.81.56";
InetAddress ina = InetAddress.getByName(serverHost);
ss = new ServerSocket(port, 10, ina);
ss.close();
}
catch(Exception e)
{
e.printStackTrace();
}