Package java.nio.channels

Examples of java.nio.channels.DatagramChannel.bind()


      NetworkInterface networkInterface = NetworkInterface.getByName("net1");

      DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET);

      dc.setOption(StandardSocketOptions.SO_REUSEADDR, true);
      dc.bind(new InetSocketAddress(8080));
      dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, networkInterface);

      InetAddress group = InetAddress.getByName("180.90.4.12");
      MembershipKey key = dc.join(group, networkInterface);
    } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.