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

Java Socket

×î½üÑо¿ÏÂsocket,ctrl+vÁËÏÂÍøÉϵĶ«Î÷:
   ÊÂʵÉÏÍøÂç±à³Ì¼òµ¥µÄÀí½â¾ÍÊÇÁ½Ì¨¼ÆËã»úÏ໥ͨѶÊý¾Ý¶øÒÑ¡£¶ÔÓÚ³ÌÐòÔ±¶øÑÔ£¬È¥ÕÆÎÕÒ»ÖÖ±à³Ì½Ó¿Ú²¢Ê¹ÓÃÒ»ÖÖ±à³ÌÄ£ÐÍÏà¶Ô¾Í»áÏԵüòµ¥µÄ¶àÁË¡£Java SDKÌṩһЩÏà¶Ô¼òµ¥µÄApiÀ´Íê³ÉÕâЩ¹¤×÷£¬Socket¾ÍÊÇÆäÖÐÖ®Ò»¡£
¡¡¡¡¶ÔÓÚJava¶øÑÔ¡£ÕâЩApi´æÔÚÓëJava.netÕâ¸ö°üÀïÃæ¡£Òò´ËÖ»Òªµ¼ÈëÕâ¸ö°ü¾Í¿ÉÒÔ×¼±¸ÍøÂç±à³ÌÁË¡£ÍøÂç±à³ÌµÄ»ù±¾Ä£Ð;ÍÊÇ¿Í»§»úµ½·þÎñÆ÷Ä£ÐÍ¡£¼òµ¥µÄ˵¾ÍÊÇÁ½¸ö½ø³ÌÖ®¼äÏ໥ͨѶ£¬È»ºóÆäÖÐÒ»¸ö±ØÐëÌṩһ¸ö¹Ì¶¨µÄλÖ㬶øÁíÒ»¸öÔòÖ»ÐèÒªÖªµÀÕâ¸ö¹Ì¶¨µÄλÖ㬲¢È¥½¨Á¢Á½ÕßÖ®¼äµÄÁªÏµ¡£È»ºóÍê³ÉÊý¾ÝµÄͨѶ¾Í¿ÉÒÔÁË¡£ÕâÀïÌṩ¹Ì¶¨Î»ÖõÄͨ³£³ÆΪ·þÎñÆ÷£¬¶ø½¨Á¢ÁªÏµµÄͨ³£½Ð×ö¿Í»§¶Ë¡£»ùÓÚÕâ¸ö¼òµ¥µÄÄ£ÐÍ£¬¾Í¿ÉÒÔ½øÈëÍøÂç±à³Ì¡£
¡¡¡¡Java¶ÔÕâ¸öÄ£Ð͵ÄÖ§³ÖÓкܶàÖÖApi.¶øÕâÀïÎÒÖ»Ïë½éÉÜÓйØSocketµÄ±à³Ì½Ó¿Ú¡£¶ÔÓÚJava¶øÑÔÒѾ­¼ò»¯ÁËSocketµÄ±à³Ì½Ó¿Ú¡£Ê×ÏÈÎÒÃÇÀ´ÌÖÂÛÓйØÌṩ¹Ì¶¨Î»ÖõķþÎñ·½ÊÇÈçºÎ½¨Á¢µÄ¡£JavaÌṩÁËServerSocketÀ´¶ÔÆä½øÐÐÖ§³Ö¡£ÊÂʵÉϵ±Äã´´½¨¸ÃÀàµÄÒ»¸öʵÁ¦¶ÔÏó²¢Ìṩһ¸ö¶Ë¿Ú×ÊÔ´Äã¾Í½¨Á¢ÁËÒ»¸ö¹Ì¶¨Î»ÖÿÉÒÔÈÃÆäËû¼ÆËã»úÀ´·ÃÎÊÄã¡£
¡¡¡¡ServerSocket server=new
¡¡¡¡ServerSocket£¨6789£©£»
¡¡¡¡ÕâÀïÉÔ΢ҪעÒâµÄÊǶ˿ڵķÖÅä±ØÐëÊÇΨһµÄ¡£ÒòΪ¶Ë¿ÚÊÇΪÁËΨһ±êʶÿ̨¼ÆËã»úΨһ·þÎñµÄ¡£ÁíÍâ¶Ë¿ÚºÅÊÇ´Ó0~65535Ö®¼äµÄ£¬Ç°1024¸ö¶Ë¿ÚÒѾ­±»Tcp/Ip ×÷Ϊ±£Áô¶Ë¿Ú£¬Òò´ËÄãËù·ÖÅäµÄ¶Ë¿ÚÖ»ÄÜÊÇ1024¸öÖ®ºóµÄ¡£
¡¡¡¡ºÃÁË¡£ÎÒÃÇÓÐÁ˹̶¨Î»Öá£ÏÖÔÚËùÐèÒªµÄ¾ÍÊÇÒ»¸ùÁ¬½ÓÏßÁË¡£¸ÃÁ¬½ÓÏßÓÉ¿Í»§·½Ê×ÏÈÌá³öÒªÇó¡£Òò´ËJavaͬÑùÌṩÁËÒ»¸öSocket¶ÔÏóÀ´¶ÔÆä½øÐÐÖ§³Ö¡£Ö»Òª¿Í»§·½´´½¨Ò»¸öSocketµÄʵÀý¶ÔÏó½øÐÐÖ§³Ö¾Í¿ÉÒÔÁË¡£
¡¡¡¡Socket client=new
¡¡¡¡Socket£¨InetAddress.getLocalHost£¨£©£¬5678£©£»
¡¡¡¡¿Í»§»ú±ØÐëÖªµÀÓйطþÎñÆ÷µÄIPµØÖ·¡£¶ÔÓÚ×ÅÒ»µãJavaÒ²ÌṩÁËÒ»¸öÏà¹ØµÄÀàInetAddress ¸Ã¶ÔÏóµÄʵÀý±ØÐëͨ¹ýËüµÄ¾²Ì¬·½·¨À´Ìṩ¡£ËüµÄ¾²Ì¬·½·¨Ö÷ÒªÌṩÁ˵õ½±¾»úIP ºÍͨ¹ýÃû×Ö»òIPÖ±½ÓµÃµ½InetAddressµÄ·½·¨¡£
¡¡¡¡ºÃÁË£¬ÉÏÃæµÄ·½·¨»ù±¾¿ÉÒÔ½¨Á¢Ò»ÌõÁ¬ÏßÈÃÁ½Ì¨¼ÆËã»úÏ໥½»Á÷ÁË¡£¿ÉÊÇÊý¾ÝÊÇÈçºÎ´«ÊäµÄÄØ£¿ÊÂʵÉÏI/O²Ù×÷×ÜÊǺÍÍøÂç±à³ÌϢϢÏà¹ØµÄ¡£ÒòΪµ×²ãµÄÍøÂçÊǼÌÐøÊý¾ÝµÄ¡£³ý·ÇÔ¶³Ìµ÷Ó㬴¦ÀíÎÊÌâµÄºËÐÄÔÚÖ´ÐÐÉÏ¡£
¡¡¡¡·ñÔòÊý¾ÝµÄ½»»¥»¹ÊÇÒÀÀµÓÚIO²Ù×÷µÄ¡£ËùÒÔÄãÒ²±ØÐëµ¼ÈëJava.ioÕâ¸ö°ü¡£JavaµÄIO²Ù×÷Ò²²»¸´ÔÓ¡£ËüÌṩÁËÕë¶ÔÓÚ×Ö½ÚÁ÷ºÍUnicodeµÄ¶ÁÕߺÍÐ


Ïà¹ØÎĵµ£º

ÓÃÉè¼ÆģʽµÄ˼ÏëÀ´¶¨ÖÆJavaÖеÄʼþ

¼¶±ð£º ³õ¼¶
ÌÆ
ÏÌ·å
(hutun@263.net
),
2001 Äê 5 ÔÂ 28 ÈÕ
Ëæ×ÅJAVAµÄѸÃÍ·¢Õ¹£¬JDK°æ±¾µÄ²»¶Ï¸ü
У¬JAVAеÄʼþÄ£ÐÍÓë¾ÉµÄJDKÄ£ÐÍÒ²ÓÐÁ˱¾ÖʵÄÇø±ð£¬ËüµÄʼþÄ£ÐÍÒ²ÓÐÁ˺ܴóµÄÇø±ð¡£ÓÉÓÚÏÖÔڵıà³Ì¶¼ÊDzÉÓÃʼþÇý¶¯£¬ËùÒÔºÜÓбØÒªÁ˽âµÄʼþÄ£
ÐÍ£¬ÎÒÃÇÏÂÃæ´Ó¶¨ÖÆʼþµÄʵ¼Ê³ö·¢À´¾ßÌåÌÖÂÛ¡£
ÎÊÌâµÄÌá³ö
......

javaÄÚ´æ»ØÊÕ»úÖÆ

ÒýÑÔ
JavaµÄ¶ÑÊÇÒ»¸öÔËÐÐʱÊý¾ÝÇø,ÀàµÄʵÀý(¶ÔÏó)´ÓÖзÖÅä¿Õ¼ä¡£JavaÐéÄâ»ú(JVM)µÄ¶ÑÖд¢´æ×ÅÕýÔÚÔËÐеÄÓ¦ÓóÌÐòËù½¨Á¢µÄËùÓжÔÏó£¬ÕâЩ¶ÔÏóͨ¹ýnew¡¢newarray¡¢anewarrayºÍmultianewarrayµÈÖ¸ÁÁ¢£¬µ«ÊÇËüÃDz»ÐèÒª³ÌÐò´úÂëÀ´ÏÔʽµØÊÍ·Å¡£Ò»°ãÀ´Ëµ£¬¶ÑµÄÊÇÓÉÀ¬»ø»ØÊÕ À´¸ºÔðµÄ£¬¾¡¹ÜJVM¹æ·¶²¢²»ÒªÇóÌØÊâµÄÀ¬»ø»ØÊÕ¼¼Êõ£ ......

Google App engine for Java¿ª·¢µÄÒ»¸ö²©¿ÍÍøÕ¾

»¥ÁªÍø³åÀ˰壬ÊÇGoogle app Engine ÔƼÆËãƽ̨ÉϵÄÒ»¸ö²©¿Í£¬ÊÇ»ùÓÚGoogle App engine for Java¿ª·¢µÄ¡£
ԭʼµÄÒâͼÊÇÒòΪٶù»¹Ð¡£¬ÏÖÔÚ»¹²»»áÔĶÁ£¬¶øÎÒÔÚÉÏÍøʱ¾­³£¿´µ½Ò»Ð©ÓÐÒæÓÐȤÉõÖÁ¿ÉÒÔ°ïÖúѧϰµÄһЩÄÚÈÝ£¬¾ÍÏë°ÑËü¼ÇÏÂÀ´Ð´ÔÚ²©¿ÍÀ¹©Å®¶ù³¤´óÔÙÈ¥¿´¿´¡£
ÁíÍ⣬ÎÒ»¹Ã»Óз¢ÏÖGoogle App engine for Java¿ª·¢µÄ ......

Sun Java moved to the Partner repository

For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead.
If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Reposi ......

JavaÈÕÆÚ ¼ÆËã

JavaÖÐÌṩÁ˷ḻµÄÈÕÆÚ±íʾ·½Ê½¡£ÆäÖаüÀ¨Date¡¢Timestamp¡¢Calendar¡¢GregorianCalendarÀà¡£GregorianCalendarÀàÖÐÌṩÁËÓÃÓÚ¼ÆËãÈÕÆÚµÄadd()·½·¨£¬¿ÉÒԺܷ½±ãµØ¼ÆËãÈô¸ÉÄê¡¢Ô¡¢ÈÕºóµÄÈÕÆÚ¡£

¸ø¸öÀý×Ó¿´¿´£º


package testjava;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ