When using IntellijIDEA 15, the following code works:

import java.nio.channels.DatagramChannel; ... DatagramChannel chan; char port; port = 30000; ... chan = DatagramChannel.open(); chan.configureBlocking(false); chan.bind(new InetSocketAddress(port)); 

The same code in Android Studio 1.5 gives an error:

cannot resolve method bind.

I looked through the proposed methods, I found only connect() . All this on the same machine. Method bind() for Android does not exist?

  • It looks like there is no dock. Try chan.socket().bind() . In android, the standard library is implemented on the basis of Apache Harmony (like Google and Oracle were resolved with each other, and announced the transition of the android to openjdk, but this is still), the DataChannel.bind() method appeared only in 1.7. - zRrr
  • <code> chan.socket (). bind () </ code> works. Thank. - mikhail

0