Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÒøÐÐǰÖûú³ÌÐò£¨Í¨ÐŲ¿·Ösocket£¬java±àд £©

2009Äê10ÔÂ31ÈÕ ÐÇÆÚÁù 15:32
package Client;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.nio.channels.IllegalBlockingModeException;
import Config.ParameterCfg;
import ErrorExcp.ErrorExcp;
import Log.Log;
import Msg.Msg.Msg;
import MsgCfg.MsgGlobalInfo;
/**
*
* @author xiehui ͨÐÅÀ࣬Êý¾ÝµÄ·¢ËÍÓë½ÓÊÜ
*
*/
public class Client {
/**
* ¸ºÔðÊý¾Ý·¢ËÍÓë½ÓÊܵÄÌ×½Ó×Ö
*/
public Socket ncpClient;
/**
* socket¶ÁÈ¡Êý¾Ý¹ÜµÀ
*/
public OutputStream writeIO;
/**
* socketдÊý¾Ý¹ÜµÀ
*/
public InputStream receiveIO;
/**
*ÈÕÖ¾¼Ç¼
*/
public Log log;
/**
* ÊÇ·ñ×öÁË×ÊÔ´ÊÍ·Å£¬±ÜÃâ¶þ´ÎÊÍ·ÅÒýÆðbug£¬Ä¬ÈÏΪ¼Ù
*/
public boolean isCloseDeal = false;
/**
* ÔÚÌ×½Ó×ÖÉÏ»ñÈ¡µÄ±¨ÎÄÐÅÏ¢
*/
public MsgInfo msgInfo;
/**
* Client()º¯ÊýΪ¹¹Ô캯Êý
*
* @param acccpetSocket
*            £ºÎª·þÎñÆ÷ͶµÝ¹ýÀ´µÄÌ×½Ó×Ö<br>
*
*            log:Ϊ´«µÝµÄÈÕÖ¾¶ÔÏ󣬷½±ãÔÚͨÐŵĹý³ÌÖн«×´Ì¬¼Ç¼ÏÂÀ´
*
* @return ûÓзµ»ØÖµµÄÄÚÈÝ
*
* @exception exceptions
*                ûÓÐÒì³£±»Å׳ö
*/
public Client(Socket acccpetSocket, Log log) {
   /**
   * Ì×½Ó×Ö±¾µØ´´½¨µÄ£¬·¢Æð·½ÊÇÅ©²úƷǰÖûú
   */
   this.ncpClient = acccpetSocket;
   this.log = log;
   msgInfo = new MsgInfo();
   /**
   * ½«·¢ÆðµÄIPµØÖ·Ð´ÈëÈÕÖ¾
   */
   log.add(acccpetSocket.getRemoteSocketAddress());
}
/**
* Ïò·þÎñÆ÷½¨Á¢Á¬½Ó
*
* @param seconds
*            £ºÎªÏò·þÎñÆ÷·¢ÆðÁ¬½ÓµÄ³¬Ê±Ê±¼ä<br>
*
*          


Ïà¹ØÎĵµ£º

¼¼ÊõÌù£ºjava nioµÄʾÀý

package com.vista.Server;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels. ......

Java¶àÏ̱߳à³ÌÏê½â

Ò»¡¢Àí½â¶àÏß³Ì
    ¶àÏß³ÌÊÇÕâÑùÒ»ÖÖ»úÖÆ£¬ËüÔÊÐíÔÚ³ÌÐòÖв¢·¢Ö´Ðжà¸öÖ¸ÁîÁ÷£¬Ã¿¸öÖ¸ÁîÁ÷¶¼³ÆÎªÒ»¸öỊ̈߳¬±Ë´Ë¼ä»¥Ïà¶ÀÁ¢¡£Ïß³ÌÓÖ³ÆÎªÇáÁ¿¼¶½ø³Ì£¬ËüºÍ½ø³ÌÒ»ÑùÓµÓжÀÁ¢µÄÖ´ÐпØÖÆ£¬ÓɲÙ×÷ϵͳ¸ºÔðµ÷¶È£¬Çø±ðÔÚÓÚÏß³ÌûÓжÀÁ¢µÄ´æ´¢¿Õ¼ä£¬¶øÊǺÍËùÊô½ø³ÌÖÐµÄÆäËüÏ̹߳²ÏíÒ»¸ö´æ´¢¿Õ¼ä£¬ÕâʹµÃÏ̼߳äµÄͨ ......

Java»·¾³±äÁ¿ÉèÖÃ

Ò»¡¢ÈçºÎ°²×°JDK£¿   
    µ±ÎÒÃÇ´ÓÍøÂçÉÏDOWNÏÂJ2SE 5.0 JDKÒÔºó£¨ÊÇÒ»¸ö¿ÉÖ´ÐÐÎļþ£¬ÎļþÃû½Ð×öjdk-1_5_0-windows-i586.exe£¬µ±È»Õâ¸öÃû×Ö»áÒòΪ¶ÔÓ¦²Ù×÷ϵͳµÄ²»Í¬¶øÓÐËùÇø±ðµÄ£¬ÎÒʹÓõIJÙ×÷ϵͳ¾ÍÊÇWINDOWS£¬´ó¼Ò·¢ÏÖÁËÂ𣿣©£¬Ë«»÷Ëû¾Í¿ªÊ¼°²×°ÁË¡£ÐèҪעÒâµÄ¾ÍÊÇÑ¡Ôñ°²×°Â·¾¶µÄÎÊÌâ ......

JavaÖеÄinstanceof¹Ø¼ü×Ö

instanceofÊÇJavaµÄÒ»¸ö¶þÔª²Ù×÷·û£¬ºÍ==£¬>£¬<ÊÇͬһÀà¶«¶«¡£ÓÉÓÚËüÊÇÓÉ×Öĸ×é³ÉµÄ£¬ËùÒÔÒ²ÊÇJavaµÄ±£Áô¹Ø¼ü×Ö¡£ËüµÄ×÷ÓÃÊDzâÊÔËü×ó±ßµÄ¶ÔÏóÊÇ·ñÊÇËüÓұߵÄÀàµÄʵÀý£¬·µ»ØbooleanÀàÐ͵ÄÊý¾Ý¡£¾Ù¸öÀý×Ó£º
¡¡¡¡String s = "I AM an Object!";
¡¡¡¡boolean isObject = s instanceof Object;
¡¡¡¡ÎÒÃÇÉùÃ÷ÁËÒ»¸öStrin ......

java file io

ʹÓÃJava²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
ÕªÒª: ×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀà
×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀ࣬ÕâÁ½¸öÀà¶¼ÊdzéÏóÀ࣬WriterÖÐ write(char[] ch,int off,int
length)£¬flush()ºÍclose()·½·¨Îª³éÏó·½· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ