HELP : Convert socket programming from Ipv4 to IPv6

Hi all,

I need help in converting my Ipv4 socket programing to Ipv6. How can I do this? I already have an Ipv4 socket programming that is working but when I tried to convert it to Ipv6 it doesn't work .

this is my Ipv4 socket programming :

DatagramPacket sendPacket;

DatagramSocket sock;

ip = jtfDIP.getText().trim();

try{

sock = new DatagramSocket();

add = InetAddress.getByName(ip);

sendPacket = new DatagramPacket(buf,buf.length,add,port);

}

Please help me. How can I convert this to Ipv6. Thank you.

[580 byte] By [siti_maza] at [2007-10-3 6:39:14]
# 1

You don't have to do anything whatsoever to your code.

See the JDK Javadoc/Guide to Features/Networking/IPv6 section.

You have to supply IPv6-format IP addresses, and you may have to set some of the system properties discussed in that document. And you may have to do something platform-dependent to your platform to enable IPv6.

ejpa at 2007-7-15 1:27:56 > top of Java-index,Archived Forums,Socket Programming...
# 2
If your network card and OS have IPv6 enabled, then you're set.
watertownjordana at 2007-7-15 1:27:56 > top of Java-index,Archived Forums,Socket Programming...
# 3
Thank you all. I've did it. but how to do ICMPv6 in java? Does java support it?
siti_maza at 2007-7-15 1:27:56 > top of Java-index,Archived Forums,Socket Programming...
# 4
Please ignore this response.Message was edited by: sabre150
sabre150a at 2007-7-15 1:27:56 > top of Java-index,Archived Forums,Socket Programming...
# 5

Socket sock = new Socket("host");

or

Socket sock = new Socket("192.168.1.1");

or

Socket sock = new Socket("www.host.com");

or

Socket sock = new Socket("hhhh.hhhh.hhhh.hhhh");

Get it? Just use whatever host, domain name, or IP you need, the underlying native code does the work - you'll never need to do anything, for the most part.

watertownjordana at 2007-7-15 1:27:56 > top of Java-index,Archived Forums,Socket Programming...