public static void main(String[] args){
 
 int port=165;
 try{
 
  socket= new DatagramSocket(port);
}catch (Exception ex){System.out.println(ex);}运行成功!
将上面的程序放入applet中
public void paint(Graphics g) {
try{
 
  socket= new DatagramSocket(port);
}catch (Exception ex){System.out.println(ex);}}
编译成功,运行失败,
错误信息是:
java.security.AccessControlException: access denied (java.net.SocketPermission localhost:165 listen,resolve)