This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Datagram Problems


Hello, everyone.

Thanks, Bryce, for responding to my earlier query. Here's a code snippet, 
the one that doesn't work. I get "Network Unreachable". Could you please 
tell me why this is happening?

I'm on RedHat 7.1, Kernel 2.4, GCC 2.96.

import java.net.*;
import java.io.*;

class test
{
	public static void main(String args[])
	{
		try{
			String str = "Message.";
			DatagramSocket ds = new DatagramSocket();
			DatagramPacket dp = new
DatagramPacket(str.getBytes(), str.length(),
InetAddress.getByName("255.255.255.255"), 8888);
			ds.send(dp);
			ds.send(dp);
			ds.close();

		}catch(Exception e)
		{
			System.out.println("EXCEPTION: " + e.toString());
		}
	}
}

Thanks a lot.

-Regards,
Suman.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]