Добро пожаловать, Гость
Логин: Пароль: Запомнить меня
Программирование на Java: вопросы, проблемы, дискуссии. Приемы и секреты кодинга. Личный опыт. Секреты профессионалов.
  • Страница:
  • 1

ТЕМА:

ServerSocketChannel.bind error 5 года 4 мес. назад #9320

  • soul
  • soul аватар Автор темы
  • Не в сети
  • Новый участник
  • Новый участник
  • Спасибо получено: 0
Hello. I am researching Oracle for training purposes. I am currently trying to program in the embedded JVM.
And I found the following error:
if you use "ServerSocketChannel.bind (new InetSocketAddress (InetAddress.getLocalHost (). getHostAddress (), port)",
then an error is caused:

"java.net.SocketException: bind failed, errno = 10049
required address for its context is incorrect.
at sun.nio.ch.Net.bind0 (Native Method)
at sun.nio.ch.Net.bind (Net.java)
at sun.nio.ch.Net.bind (Net.java)
at sun.nio.ch.ServerSocketChannelImpl.bind (ServerSocketChannelImpl.java)
at java.nio.channels.ServerSocketChannel.bind (ServerSocketChannel.java)"

Any attempt to bind ServerSocketChannel by name or IP address results in this error.
I have not found any description of this error on the Internet, and it is suggested that this
development error.
OS Windows7 64 bit, Windows 10. Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
Partially this error corrects: "System.setProperty ("java.net.preferIPv4Stack", "true")";
In this case, ServerSocketChannel.bind () works well,
but attempt to return ip address:
"ServerSocketChannel.socket (). GetInetAddress (). GetHostAddress ());"
or
"ServerSocketChannel.getLocalAddress ();"
causes an error

"java.lang.NullPointerException
at java.net.Inet4Address.getAddress(Inet4Address.java)
at java.net.Inet4Address.getHostAddress(Inet4Address.java)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java)"

therefore, this error is always called as soon as it tries to connect to the listener.
is it possible to fix it?

Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.

  • Страница:
  • 1
Время создания страницы: 0.189 секунд