Java Socket ³¤Á¬½ÓͨÐÅ
×î½üÏîÄ¿ÖÐÓиöÐèÇó£¬ÒªÓÃSocketʵÏÖ³¤Á¬½Ó£¬²¢ÇÒÔÚͨÐŹý³ÌÖÐÒª»¥ÎªserverºÍclient£¬¼´ÔÚÒ»¸öÁ¬½ÓÖУ¬¼ÈÄܹ»·¢ËÍÏûÏ¢£¬£¨´Ëʱ×÷Ϊ¿Í»§¶Ë£©£¬ÓÖÒªÄܹ»½ÓÊÕÏûÏ¢£¨´Ëʱ×÷Ϊserver¶Ë£©£¬Ñо¿ÁËÏ£¬ÊµÏÖ·½Ê½ÈçÏ£º
Ò»¡¢·¢ËÍÏûϢʱ½¨Á¢Á¬½Ó£¬¹¹½¨Í¨µÀ¡£
Socket socket = new Socket();
SocketAddress endpoint = new InetSocketAddress("IP", port);
try {
socket.connect(endpoint, 10000);
} catch (Exception e) {
e.printStackTrace();
}
¶þ¡¢Í¬Ê±Æô¶¯ÁíÒ»¸öỊ̈߳¬¸ÃÏß³ÌÓÃÀ´½ÓÊÕÏûÏ¢
¸ÃÏß³ÌÀï´«Èë²½ÖèÒ»ÒѾ´´½¨ºÃµÄsocketÁ¬½Ó
public class Parse extends Thread
{
public Parse(Socket client) {
this.client = client;
}
public void run() {
in = client.getInputStream();
out = client.getOutputStream();
//¶ÁÈ¡Êý¾Ý
}
}
Èý¡¢Èç´Ë£¬Ö»Òª³ÌÐòÆô¶¯£¬Á½±ß¶¼²»¶Ï¿ªÁ¬½Ó£¬´ËÁ¬½Ó¼´Îª³¤Á¬½Ó£¬Í¬Ê±£¬ÔÚ²½Öè¶þ¶ÁÈ¡Êý¾ÝµÄ¹ý³ÌÖУ¬¼ÓÈëÒì³£µÄ´¦Àí£¬Èç¹ûÖÐ;socket¶Ï¿ª£¬ÔòÖØÐÂÁ¬½Ó¡£
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
Ò»¸öjavaµÄclassÎļþÊÇÒ»¸ö¶þ½øÖÆÎļþ£¬ÆäÖÐÇ°Ëĸö×Ö½ÚÊÇmagic룬µÚÎåµ½µÚÁù¸ö×Ö½Ú¶ÔÓ¦ÓÚminorºÍmajor£¬ÏÂÃæÊÇÕâ¸öÀàÎļþ°æ±¾ÓëJDKµÄ¶ÔÓ¦¹Øϵ¡£classÎļþµÄminorºÍmajor¿ÉÒÔͨ¹ýultraeditÀ´²é¿´£¬»ò×Ô¼º±à³ÌµÈ¡£
major minor Java platform version
45 3 1.0
45 3 1.1
46 0 ......
ÉîÈëÀí½âjava¶à̬ÐÔ
×òÌì¿´µ½Ò»¸ö¹ØÓÚ¶à̬ÐÔµÄÌû×Ó£¬²Î¿¼ÁË»ØÌûÕßµÄÀí½â£¬¼ÓÈëÁËһЩ×Ô¼ºµÄ¿´·¨£¬ÕûÀí³öÀ´¹©´ó¼Ò²Î¿¼£¬²»Ò»¶¨ ......
javaÉú³Éword,htmlÎļþ²¢½«ÄÚÈݱ£´æÖÁÊý¾Ý¿â
Posted on 2005-12-15 17:19 Kela ÔĶÁ(3126) ÆÀÂÛ(3) ±à¼ ÊÕ²Ø
ÔÚ×î½üµÄÒ»¸öÏîÄ¿ÖÐÐèÒª½«Ò»¶Î×Ö·ûÀàÐ͵ÄÎı¾´æΪword£¬html²¢Òª½«wordµÄÄÚÈݱ£´æÔÚÊý¾Ý¿âÖУ¬ÓÚÊ ......
×î½üÔÚÕÒ¹¤×÷£¬»ù±¾¶¼ÊÇjava¿ª·¢µÄ·½Ïò£¬ºÜ¶à±ÊÊÔ¡¢ÃæÊÔÌⶼÊÇΧÈÆStringÀà¶ÔÏóÕ¹¿ªµÄ£¬»¨ÑùºÜ¶à£¬µ«ÊÇÍò±ä²»ÀëÆäÖУ¬ÕÆÎÕÁË»ù±¾µÄÔÀí£¬ÎÞÂÛÔõô±ä£¬ÊµÖʶ¼ÊÇÒ»ÑùµÄ¡£ÏÂÃæ×ܽáһϹØÓÚStringµÄ»ù±¾ÖªÊ¶µã£º
£¨Ò»£©StringÊÇfinalµÄ
¿ÉÄÜÎÒÃǺܶàÈËÓöµ½¹ýÕâ¸öÎÊÌâfinal¹Ø¼ü×ÖÓÐʲô×÷Óã¬ÆäÖÐÒ»¸ö»Ø´ð¾ÍÊÇfinalÐÞÊÎ ......