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

JavaÍøÂç±à³Ì³õ²½

JavaÍøÂç±à³Ì³õ²½
Kagula
2009-11-23
¹Ø¼ü´Ê
Java  Socket  DataInputStream   DataOutputStream
¸ÅÒª
    ʹÓÃJavaͬ²½IOÓ¦ÓóÌÐò¿â£¬ÊµÏÖCS½á¹¹ÍøÂç±à³Ì¡£
ÕýÎÄ
ʹÓÃSocketÀ´½¨Á¢ÍøÂçÁ¬½Ó£¬Ê¹ÓÃDataInputStream¡¢DataOutputStreamÀ´´æÈ¡ÍøÂçÁ÷¡£
 
¿Í»§¶Ë²¿·Ý
µÚÒ»²½£º½¨Á¢ÍøÂçÁ¬½Ó¶ÔÏ󣬺ÍÍøÂçÁ÷ÊäÈëÊä³ö¶ÔÏó
Socket c = new Socket(InetAddress.getByName("192.168.0.144"),6009);
dis      = new DataInputStream(c.getInputStream());
dos      = new DataOutputStream(c.getOutputStream());
µÚ¶þ²½£º¶ÁдÍøÂçÁ÷
д×Ö·û´®ÓÃÏÂÃæµÄ´úÂë
dos.writeUTF(list.get(i).toString());
dos.flush();
д¶þ½øÖÆÊý¾Ý²ÉÓÃÏÂÃæµÄ´úÂë
//byte[] b = new byte[nnL];
dos.write(b,0,nnL);
dos.flush();
ÕâÀïҪעÒâµÄÊÇwriteº¯ÊýµÄµÚ¶þ¸ö²ÎÊý£¬Ö¸µÄÊÇ»º´æÇøÆðʼλÖã¬nnLÖ¸µÄÊÇ»º´æÇøÖÐÊý¾ÝµÄ³¤¶È¡£b»º´æµÄ´óС½¨ÒéΪ1KB£¬¹ý´ó»áµ¼Ö²¿·ÝÊý¾Ý·¢ËͳöÈ¥ÁË£¬µ«ÊǽÓÊÕµ½Ã»ÓÐÊÕµ½ÓÐЧµÄÊý¾Ý¡£
¶Á×Ö·û´®ÓÃÏÂÃæµÄ´úÂë
String sR = dis.readUTF();
¶Á¶þ½øÖÆÊý¾ÝÓÃÏÂÃæµÄ´úÂë
 
Dis.read(b,0,nnL);
ÕâÀïÐèҪעÒ⣬·¢ËͶËͬ½ÓÊÕ¶ËÖ®¼ä£¬ÍøÂçÁ÷´æÈ¡º¯ÊýҪƥÅ䣬Êý¾Ý³¤¶ÈҲҪƥÅ䣬·ñÔò»á×èÈû¡£
µÚÈý²½£º¹Ø±ÕÁ¬½Ó¡£´úÂëÈçÏÂ
Dis.close();
Dos.close();
C.close();
·þÎñ¶Ë²¿·Ý
     µÚÒ»²½£º½¨Á¢ServerSocket¶ÔÏ󣬵õ½¿Í»§¶ËµÄÁ¬½ÓÇëÇ󣬴úÂëÈçÏ£º
ServerSocket server = new ServerSocket(listenPort);
Socket incomingConnection = null;
while(true) {
   incomingConnection = server.accept();
   incomingConnection.setSoTimeout(9*60*1000);
   handleConnection(incomingConnection);
}
ÆäÖУ¬listenPortÊÇÕìÌý¶Ë¿ÚΪÕûÐÍ¡£¿Í»§Í¬·¢ËÍÇëÇóºó£¬·þÎñ¶ËºÍ¿Í»§¶Ë½¨Á¢Á¬½Ó£¬server.accept·µ»Øsocket¡£
ÀûÓÃsocket£¬µÃµ½¶ÁдÍøÂçÁ÷Êý¾ÝµÄ¶ÔÏó£¬ÆäËüͬ¿Í»§¶ËµÄ±à³Ì·½Ê½¡£ÔÚÍê³É¶ÁдºóÄãÒ²ÐèÒªµ÷ÓÃsocketʵÀýµÄcloseº¯Êý£¬¶Ï¿ªÍ¬¿Í»§¶ËµÄÁ¬½Ó¡£SocketʵÀýµÄsetSoTimeoutÉèÖ㬱£Ö¤ÔÚ¾ÅÃëºó×Ô¶¯¹Ø±Õͬ¿Í»§¶ËµÄÁ¬½Ó¡£
 
 
×ܽ᣺
Ïà±ÈC++£¬JavaÌṩµÄAPI·Ç³£ÈÝÒ×ʹÓᣵ«ÊÇҲҪעÒ⼸¸öÎÊÌâ¡£[1]·þÎñ¶ËºÍ¿Í»§¶ËµÄ¶Áдº¯Êý±ØÐëҪƥÅä¡£[2]·þÎñ¶Ëͬ¿Í»§¶ËÖ®¼ä¶


Ïà¹ØÎĵµ£º

javaÈëÃÅ

 Javaѧϰ´ÓÈëÃŵ½¾«Í¨ 
Ò»¡¢ JDK (Java Development Kit) 
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

Java±à³Ì²ËÄñ¿Î³Ì£º×´Ì¬¶ÔÏó

ÕâÊÇÒ»¸öʵսÖзdz£ÖØÒªµ«ÊÇÈÝÒ×±»ºöÊӵĸÅÄ˵ËüÖØÒª£¬ÊÇÒòΪËü±ÈDatcbaseÖØÒª£»ËµËüÈÝÒ×±»ºöÊÓÒ²ÊÇͬÑùµÄÔ­Òò£¬Ëü¾­³£±»Datcbase¸ÅÄîÌæ´ú¡£
¡¡¡¡Èç¹ûÄã¾­ÑéºÍ¾­ÀúÖÐûÓÐ״̬Õâ¸ö¸ÅÄ¼«¶ËµØ˵£º¿ÉÄÜÄãµÄjava±à³Ì±à³ÌSys¾­Ñ黹δ»ýÀÛµ½Ò»¶¨³Ì¶È£¬×´Ì¬ÊÇÿ¸öjava±à³Ì±à³Ì³ÌʽԱÉîÈëjava±à³Ì±à³ÌSysºó±ØÈ»Åöµ½µÄÎÊÌâ¡£
......

Java СÀý×Ó£ºÏÂÔز¢±£´æÍøÂçС˵

±¾Ê¾Àý´ÓÍøÉÏÏÂÔØÒ»±¾Ð¡Ëµ£¬²¢±£´æΪ UTF-8 ¸ñʽ¡£
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.MalformedURLException; ......

javaµÄÇáÁ¿¼¶Ó¦ÓÃseasar+flex

Seasar2
Ò»¸öÏîÄ¿ÖÐÒªÓõ½seasar+flex,¾Ý˵Õâ¸ö¶«Î÷ÔÚСÈÕ±¾ÄÇÀïÒѾ­´óÁ¿ÓÃÓÚÆóÒµ¼¶B/SÓ¦Ó㬵±È»Õâ¸ö¿ªÔ´×é¼þÒ²ÊÇËûÃÇ¿ª·¢µÄ,ËùÒÔÊÕ¼¯Ò»Ð©Ïà¹Ø×ÊÁÏ,±¸Íü..
Ëùν“Seasar2”¾ÍÊÇÒ»¸ö“ÇáÁ¿¼¶ÈÝÆ÷”£¬ÃæÏòÎÞ·¨°ÚÍÑ“Java Ó¦Óÿª·¢”Ö®·³ÄÕµÄËùν“¿ª·¢Õß”£¬ËüÄܹ»±£Ö¤¿ª·¢µÄ&ldq ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ