Results 1 to 1 of 1
- 10-04-2011, 04:26 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 1
- Rep Power
- 0
DatagramSocket problem when using IPV6
Hello,
I've got an odd problem. I have to adapt a program to work with IPV6. The code below exemplifies my problem:
Java Code:public static void main(String[] args) { try { String serverHostname = new String ("fd22::1"); Inet6Address inetd6 = (Inet6Address)InetAddress.getByName(serverHostname); Inet6Address inet6 = (Inet6Address)InetAddress.getByName(new String("fd22::3")); DatagramSocket clientSocket = new DatagramSocket(5080, inet6); byte[] msg = new byte[1025]; DatagramPacket dp = new DatagramPacket(msg,msg.length,inetd6,7000); clientSocket.send(dp); clientSocket.close(); } catch ( IOException ex ) { ex.printStackTrace(); }
When I send messages with more than 1024 bytes to a machine that does not exist in my network ( fd22::1 is not valid ). I get the following output:
I don't think this code is supposed to throw a SocketException. When I send a datagram to an invalid IPV4 address, it's not a problem. UDP is connectionless, so I can't figure out the problem here.Java Code:java.net.SocketException: Interrupted function call: Datagram send failed at java.net.PlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(Unknown Source) at Main.main(Main.java:23)
Similar Threads
-
Check if an IP is IPV6
By tiasen24 in forum NetworkingReplies: 1Last Post: 05-19-2011, 10:30 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks