Java UDP를 이용한 Magic Packet Sender

개인적으로 쓰려고 Java UDP를 이용하여 Magic Packet을 전송하는 프로그램을 만들어봤다.

실행 화면

Java Magic Packet Sender
Java Magic Packet Sender







관련 소스



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

public class Main extends javax.swing.JFrame
{

 public Main()
 {
  initComponents();
 }

 private void initComponents()
 {
  this.setTitle(“Java Magic Packet Sender”);
  bTrans = new javax.swing.JButton();
  bClose = new javax.swing.JButton();
  mac_address = new javax.swing.JTextField();
  mac_address.setText(“”);
  mac_address.setColumns(20);
  bClose.setText(“닫기”);
  bClose.addActionListener(new java.awt.event.ActionListener()
  {
   public void actionPerformed(java.awt.event.ActionEvent evt)
   {
    ExitActionPerformed(evt);
   }
  });
  bTrans.setText(“전송”);
  bTrans.addActionListener(new java.awt.event.ActionListener()
  {
   public void actionPerformed(java.awt.event.ActionEvent evt)
   {
    TransActionPerformed(evt);
   }
  });
  getContentPane().add(“East”, bTrans);
  getContentPane().add(“South”, bClose);
  getContentPane().add(“Center”, mac_address);
  setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  pack();
 }

 private boolean parseMacAddress(String text)
 {
  boolean result = true;
  if (text.equals(“”))
   return false;
  try
  {
   int minus = text.indexOf(“-“);
   int colon = text.indexOf(“:”);
   if (minus >= 0)
   {
    StringTokenizer token = new StringTokenizer(text, “-“, false);
    int count = token.countTokens();
    mac = new byte[count];
    for (int i = 0; i < count; i++)
    {
     String to = token.nextToken();
     byte temp = (byte)(Integer.parseInt(to, 16));
     mac[i] = temp;
    }
   }
   else if (colon >= 0)
   {
    StringTokenizer token = new StringTokenizer(text, “:”, false);
    int count = token.countTokens();
    mac = new byte[count];
    for (int i = 0; i < count; i++)
    {
     String to = token.nextToken();
     byte temp = (byte)(Integer.parseInt(to, 16));
     mac[i] = temp;
    }
   }
   else
   {
    result = false;
   }

  }
  catch (Exception e)
  {
   result = false;
  }
  return result;
 }

 private void TransActionPerformed(java.awt.event.ActionEvent evt)
 {

  if (mac_address.getText() != null && !mac_address.getText().equals(“”))
  {
   if (parseMacAddress(mac_address.getText()))
   {
    try
    {
     int total_length = header.length + (mac.length * 16);
     message = new byte[total_length];
     for (int i = 0; i < header.length; i++)
     {
      message[i] = header[i];
     }
     int count = header.length;
     for (int j = 0; j < 16; j++)
     {
      for (int i = 0; i < mac.length; i++)
      {
       message[count++] = mac[i];
      }
     }
     InetAddress group = InetAddress.getByName(“255.255.255.255”);
     DatagramSocket ds = new DatagramSocket(6);
     DatagramPacket dsheaer = new DatagramPacket(message, message.length, new InetSocketAddress(“255.255.255.255”, 6));
     ds.send(dsheaer);
     ds.close();
    }
    catch (Exception e)
    {
     e.printStackTrace();
    }
   }
  }
 }

 private void ExitActionPerformed(java.awt.event.ActionEvent evt)
 {
  this.dispose();
 }

 public static void main(String args[])
 {

  if (args != null && args.length > 1)
  {

  }
  java.awt.EventQueue.invokeLater(new Runnable()
  {
   public void run()
   {
    new Main().setVisible(true);
   }
  });
 }

 private byte[] header = { (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255 };
 private byte[] mac;
 private byte[] message;
 private javax.swing.JButton bTrans;
 private javax.swing.JButton bClose;
 private javax.swing.JTextField mac_address;

}

ora-12638 credential retrieval failed

ora-12638 credential retrieval failed 에 대한 Oracle 포럼 에 올라와 있는 답변

Hi JA,

I’m no Oracle expert, but from what can make out the NTS option makes the Oracle client attempt to use your current Windows domain credentials to authenticate you with the Oracle server. This could fail for a couple of reasons:

– The Oracle server is not configured to support Windows authentication
– The credentials you use to login to your local machine are not sufficient to allow you to login to the server.

In my case, it was the later. Despite the fact that I had told the client to use a different user name and password, it was still attempting to login using my domain credentials first. This failed because I was logged on to my local machine using my normal domain credentials rather than my administrator account.

Replacing the line:

SQLNET.AUTHENTICATION_SERVICES= (NTS)

with

SQLNET.AUTHENTICATION_SERVICES= (NONE)

in sqlnet.ora resolved the issue by disabling local support for authenticating using Windows credentials.

HTH,
Carey

출처 – oracle forum
http://forums.oracle.com/forums/thread.jspa?threadID=332525

상속계층의 표현

상속계층에 있는 클래스를 다음과 같이 클래스 별로 Table을 등록

public class Item {
 private int itemNumber;
 private String itemName;
 ….
}

public class LargeItem extends Item {
 private Vector middleItemList;
 …
}

<hibernate-mapping package=”net.maxoft.session.beans”>
  <class name=”Item” table=”CategoryItem”>
      <id name=”itemNumber” column=”Id”  unsaved-value=”null”>
          <generator class=”increment”/>
      </id>    
      <property name=”itemName” column=”CategoryName”/>  
     
      <joined-subclass name=”LargeItem” table=”LargeCategory”>
          <key column=”Id”/>         
          <bag name=”middleItemList”>
              <key column=”parentItem”/>
              <one-to-many class=”MiddleItem”/>
          </bag>             
      </joined-subclass>
  </class>
</hibernate-mapping>

VC Resource 관련

리소스 ID충돌을 피하기 위하여 다음과 같은 루틴을 사용하게 된다.

#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        263
#define _APS_NEXT_COMMAND_VALUE         33249
#define _APS_NEXT_CONTROL_VALUE         1152
#define _APS_NEXT_SYMED_VALUE           104
#endif
#endif

각각의 심볼의 의미는 다음과 같다.

_APS_NEXT_RESOURCE_VALUE is the next symbol value that will be used for a dialog resource, menu resource, and so on. The valid range for resource symbol values is 1 to 0x6FFF.


_APS_NEXT_COMMAND_VALUE is the next symbol value that will be used for a command identification. The valid range for command symbol values is 0x8000 to 0xDFFF.


_APS_NEXT_CONTROL_VALUE is the next symbol value that will be used for a dialog control. The valid range for dialog control symbol values is 8 to 0xDFFF.


_APS_NEXT_SYMED_VALUE is the next symbol value that will be issued when you manually assign a symbol value using the New command in the Symbol Browser.

여러개의 rc파일을 사용시 새로운 rc파일에서 리소스 추가 전에 충돌하지 않는 새로운 시작 ID를 할당한다. 너무 큰 숫자를 할당하게 되면 더이상 사용할 수 있는 리소스가 없어지므로 주의한다.

할당예)
#define _APS_NEXT_RESOURCE_VALUE  2000
#define _APS_NEXT_COMMAND_VALUE   42000
#define _APS_NEXT_CONTROL_VALUE   2000
#define _APS_NEXT_SYMED_VALUE     2000