Datagram Problems

Suman Sai saisuman@hotmail.com
Sun Feb 17 23:31:00 GMT 2002


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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /