Mercurial > hg > Members > riono > TreeVNC_ja_comment
comparison src/main/java/jp/ac/u_ryukyu/treevnc/FindRoot.java @ 437:345c92f0b67d
send multicasts to both ipv4 and ipv6
author | Nozomi |
---|---|
date | Sun, 12 Jun 2016 19:05:26 +0900 |
parents | 9db8862ef200 |
children | d409e89ec8ec |
comparison
equal
deleted
inserted
replaced
436:9db8862ef200 | 437:345c92f0b67d |
---|---|
52 buf.put((byte) 0); | 52 buf.put((byte) 0); |
53 buf.putInt(4); // length | 53 buf.putInt(4); // length |
54 buf.putInt(port); | 54 buf.putInt(port); |
55 buf.flip(); | 55 buf.flip(); |
56 | 56 |
57 DatagramPacket sendPacket = new DatagramPacket(buf.array(), buf.limit(), mAddr, ConnectionParams.DEFAULT_VNC_ROOT_FINDER); | 57 |
58 try { | 58 try { |
59 soc.send(sendPacket); | 59 DatagramPacket sendPacket = new DatagramPacket(buf.array(), buf.limit(), InetAddress.getByName(TreeRootFinderListener.Ipv6McastAddr), ConnectionParams.DEFAULT_VNC_ROOT_FINDER); |
60 soc.send(sendPacket); | |
60 } catch (IOException e) { | 61 } catch (IOException e) { |
61 System.out.println("cannot send FindRoot packet."); | 62 System.out.println("cannot send FindRoot packet."); |
63 e.printStackTrace(); | |
64 } | |
65 | |
66 try { | |
67 DatagramPacket sendPacket1 = new DatagramPacket(buf.array(), buf.limit(), InetAddress.getByName(TreeRootFinderListener.Ipv4McastAddr), ConnectionParams.DEFAULT_VNC_ROOT_FINDER); | |
68 soc.send(sendPacket1); | |
69 } catch (IOException e) { | |
70 System.out.println("cannot send FindRoot packet."); | |
62 e.printStackTrace(); | 71 e.printStackTrace(); |
63 } | 72 } |
64 soc.close(); | 73 soc.close(); |
65 } | 74 } |
66 | 75 |