EE버전 헬리우스를 실행하는데 갑자기 떠서 놀랬다

하지만..

eclipse.ini 파일을 열어서

openFile 아래에

-vm
C:\Program Files\Java\jdk1.6.0_22\bin\javaw.exe

를 추가해주면 된다... -_- 닷넷하다가 자바하려니 이클립스가 시비다 ㅠ_ㅠ

말이 C#과 연동이지..

아이피랑 포트랑만 연결되면.. 다들 된다 ㅠㅠ

그러니 다들 돌 좀 던지지 마세요 ㅠㅠ


import java.util.Calendar;
import java.util.Timer;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class pay_Main {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  //Timer timer = new Timer();
  //Calendar date = Calendar.getInstance();
  //timer.schedule(new TimeRun(), date.getTime(), 1 * 1000);
  ServerSocket ServerSocket = null;
        Socket AcceptSocket = null;      
       
        int port = 8520;

        try{
            ServerSocket = new ServerSocket( 8520, 2000 );                                      /* Create Server Socket. 2000 개 fork 가능 */
            System.out.println("Client Connect "+ ServerSocket.getInetAddress() + " 포트: " + port + "에 바인드 되었습니다.");
 
  
            while(true) {
                System.out.println("Client Connect Wait");
                AcceptSocket = ServerSocket.accept();
               
                String ip =  AcceptSocket.getInetAddress().toString();
                  
                System.out.println("Connection");

                NXService service = new NXService(AcceptSocket);
                service.run();
            }
        }catch(IOException ex) {
        }finally {
            try {
              if (ServerSocket != null) ServerSocket.close();
             }catch(Exception ex2) {
             }
        }
 } 
}
class NXService extends Thread
{
    Socket xSocket;

    final int miCutNum  = 1024;                        
    final int miCut     = 960;                         
    byte[] buff         = null;                        

    DataInputStream din     = null;                    
    DataOutputStream dout   = null;                    
    int protocol            = 0;                       

    BufferedReader br;
    BufferedWriter bw;

    String[] sCuttingString;                           
    String sReturnValue = "";


    public NXService(Socket Sock) {
        super();
        xSocket = Sock;
    }

    public void run() {
        String sAddString = "";    
        try {

            this.din  = new DataInputStream(new BufferedInputStream(xSocket.getInputStream()));        
            this.dout = new DataOutputStream(new BufferedOutputStream(xSocket.getOutputStream()));     

            while(true){
                try {

                    buff = new byte[miCutNum]; 
                   protocol = (byte)this.din.read(buff);                                
                   
                        String sData= new String(buff);

                        System.out.println(sData);
                        dout.writeBytes("ServerReceive");
                        dout.flush();
                }
                catch(Exception e){  
                    break;
                }finally{}

            } // end whlie


                }catch(Exception e){
                    System.out.println("Error : Server Send & Receive to Client");    
                }
           
    }

}

 

요새 포스팅도 안하고 해서 반성의 시작으로 한번 해 본 코드..

좀 간단하게;;

서버는 Java로 구성해봤는데.. ㅠㅠ

단지 테스팅용으로..  한거니까 다른 분들 들어오시면 돌 던지지마세요 ㅠㅠ

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;

namespace JavaServerTest
{
    public partial class Form1 : Form
    {
        IPEndPoint ipEP;
        Socket socket = null;
        IPHostEntry ipHE;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            System.Console.WriteLine("프로그램 시작 윈도우 폼 활성화");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Encoding encString = Encoding.GetEncoding(949);
            byte[] d_byte = new byte[1024];
            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            //ipHE = Dns.GetHostByName("127.0.0.1");
            ipEP = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8520);
            socket.Connect(ipEP);
            string s_data = "Client Start";

            d_byte = encoding.GetBytes(s_data);
            System.Console.WriteLine("보낼 준비");
            socket.Send(d_byte);

            byte[] R_byte = new byte[1024];
            System.Console.WriteLine("받을 준비");
            int size = socket.Receive(R_byte);
            System.Console.WriteLine(encString.GetString(R_byte, 0, size));
            socket.Close();
        }
    }
}

여기까지가 클라이언트!!

말 그대로 간단하다;;

요새 공부를 안했더니.. 좀 더 발전해야하는데...