⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nioclient.java

📁 短信发送
💻 JAVA
字号:
/**
 * Created at Nov 21, 2008
 */
package com.jdev.net.samples;

import com.jdev.net.connector.Connection;
import com.jdev.net.connector.ConnectionFactory;
import com.jdev.util.Debug;

/**
 * <p>Title: NIOClient</p>
 * <p>Description: </p>
 * @author Lawrence
 * @version 
 */
public class NIOClient {

	  private ConnectionFactory connFactory = ConnectionFactory.getInstance(
		      ConnectionFactory.CLIENT);
	  public void Start(){
		  try{
			  Connection conn = connFactory.getConnection();
			  conn.open("127.0.0.1", 6188);
			  
			  conn.writeString("test ok");
			  String str = conn.readString();
			  
			  Debug.logVerbose(str);
			  
		  }catch(Exception e){
			  
		  }
	  }
	/**
	 * 
	 */
	public NIOClient() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
        try {
//          ServerHandler server = new ServerHandler();
//          Notifier notifier = Notifier.getNotifier();
//          notifier.addListener(server);
//
//          System.out.println("Server starting ...");
//          Reactor s = new Reactor(6188);
//          Thread tServer = new Thread(s);
//          tServer.start();
        	NIOClient server = new NIOClient();
        	server.Start();
      	
      }
      catch (Exception e) {
          System.out.println("Server error: " + e.getMessage());
          System.exit(-1);
      }
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -