Article ID: 186032
Article Last Modified on 11/14/2005
// DatagramSocketDemo.java
// ======================
import java.awt.*;
import java.net.*;
public class DatagramSocketDemo extends java.applet.Applet {
Label label=new Label("");
public void init() {
setLayout(new BorderLayout());
add(new Button("Click me to create a Datagram"),"North");
add(label,"Center");
}
public boolean action(Event ev, Object ob) {
try {
DatagramSocket ds=new DatagramSocket(9000);
System.out.println("Succeeded");
label.setText(
"Bug Fixed -- successfully created a DatagramSocket."
);
} catch (SocketException ex) {
ex.printStackTrace();
label.setText("SocketException: "+ex.getMessage());
} catch (com.ms.security.SecurityExceptionEx ex) {
ex.printStackTrace();
label.setText("Bug -- SecurityExceptionEx: "+ex.getMessage());
}
return true;
}
}
<HTML> <HEAD> <TITLE>DatagramSocketDemo</TITLE> </HEAD> <BODY> <APPLET CODE=DatagramSocketDemo width=600 height=100> </APPLET> <HR> <A HREF="DatagramSocketDemo.java">The source.</a> </BODY> </HTML>
181374 INFO: Related Component Download Articles
175622 PRB: SecurityExceptionEx Exception Running a Java Applet
193877 HOWTO: Make your Java Code Trusted in Internet Explorer
Additional query words: securityexception datagramsocket kbDSupport kbdsi
Keywords: kbbug kbfix kbnetwork kbjava kbsecurity kbjavavm31xxfix KB186032