think in javaµÚÊ®ÎåÕ¹ØÓÚÍøÂç±à³ÌµÄ¶ÁÊé±Ê¼Ç
¶ÔÓÚjavaµÄÍøÂç±à³ÌÊéÖÐÌÖÂÛµÄÈ«²¿¹éÄÉÆðÀ´ÓÐSocketµÄʹÓã¬DatagramSocketµÄʹÓã¬javaÓëCGIµÄÅäºÏʹÓã¬javaÁ¬½ÓÊý¾Ý¿âÒÔ¼°javaÖе÷ÓÃÔ¶³Ì·½·¨¡£
Ê×ÏÈÊÇSocketµÄʹÓ㬶ÔÓÚ·þÎñ¶ËÀ´Ëµ£¬Ó¦¸ÃÉùÃ÷µÄÊÇServerSocket¶ÔÏó£¬È»ºóʹÓÃSocket
accept()·½·¨½øÐжԶ˿ڽøÐмàÌý¡£Èç¹ûÓпͻ§»ú´´½¨Ò»¸öSocket(·þÎñÆ÷IP,
·þÎñÆ÷¶Ë¿Ú)¶ÔÏó½øÐÐÁ¬½Ó£¨´´½¨Ò»¸öSocketµÄʱºò¾Í»á×Ô¶¯½øÐÐÁ¬½Ó£©¡£accept·½·¨¾Í»á·µ»ØÒ»¸öSocket¶ÔÏó¡£´Ëʱ·þÎñÆ÷Óë¿Í»§»ú¾ÍÄܾÍÄÜ
ͨ¹ýSocketÌṩµÄgetInputStream()ºÍgetOutputStream()·µ»ØµÄIO½øÐн»»¥ÁË¡£µ«ÊÇҪעÒâµÄ¾ÍÊÇÒ»µ©
ServerSocketµ÷ÓÃÁËaccept()Õâ¸ö·½·¨£¬ÄÇôÕâ¸öÏ߳̾ͻáÓÃÓÚ¼àÌý¶Ë¿Ú£¬Èç¹ûûÓпͻ§¶ËÁ¬½Ó½øÀ´Õâ¸öÏ߳̾ͻáһֱͣÁôÔÚÄǸö·½·¨Àï¡£Ëù
ÒÔSocket×îºÃ»¹ÊǺͶàÏ߳̽øÐнáºÏʹÓᣱÈÈçдһ¸ö¼Ì³ÐÁËThreadµÄÀàÀïÃæ°üº¬Ò»¸öSocket¶ÔÏó¡£
Ö®ºóÊÇDatagramSocketµÄʹÓã¬Õâ¸öºÍSocketµÄ²»Í¬ÔÚÓÚ£ºDatagramSocketÊÇUDPÐÒé¶øSocketÊÇTCP/IPÐ
Òé¡£UDPÐÒéµÄ¿É¿¿ÐÔ±ÈTCP/IPÐÒéÂԲµ«ÊÇUDPÐÒéÈ´ÓкܸߵĴ«ÊäËٶȣ¬Ê¹ÓÃÓÃÓÚ¼´Ê±ÐÔºÜÇ¿µÄ³ÌÐò£¨Ä§ÊÞÕù°ÔÓë°µºÚ¶¼Êǽ¨Á¢UDPÁ¬½ÓµÄ£©¡£
¶ÔÓÚDatagramSocketµÄʹÓ÷½·¨ºÍSocketµÄÓкܴó²»Í¬¡£¾ßÌåÀ´ËµDatagramSocketÒªºÜDatagramPacketÀàÅäºÏ
ʹÓã¬DatagramSocket²»±ØÏñSocketÄÇÑù½¨Á¢Ò»¸öÒ»Ò»¶ÔÓ¦µÄÁ¬½Ó£¬DatagramSocketÔÚ½»»¥Éϳ£ÓõÄÁ½¸ö·½·¨ÊÇvoid
receive(DatagramPacket p)ºÍvoid send(DatagramPacket
p)¡£¶ÔÓÚDatagramSocket¶ÔÏñµÄ´´½¨·½·¨ÓжàÖÖ£¬ÆäÖÐnew DatagramSocket(int
port)Êǽ«Æä°ó¶¨µ½±¾µØÖ÷»úÉϵÄÖ¸¶¨¶Ë¿Ú£¬¶ønew
DatagramSocket()ÔòÊǽ«Æä°ó¶¨µ½±¾µØÖ÷»úÉÏÈκοÉÓõĶ˿ڡ£È»ºóÖ»ÐèʹÓÃreceiveºÍsendÊÕ·¢DatagramPacket¶Ô
Ïó¡£DatagramPacketÖаüº¬Á˱¾µØµØÖ·¡¢¶Ë¿Ú¡¢ÏûÏ¢ÒÔ¼°Ä¿µÄµØµÄµØÖ·ºÍ¶Ë¿Ú¡£ËùÒÔÊÕµ½Ò»¸öDatagramPacket°üÒÔºó£¬Ö»Ðëµ÷Ó÷½·¨
getAddress(),getPort()¾ÍÄÜ»ñµÃ·¢ËÍ»úÆ÷µÄÐÅÏ¢£¬ÓÐÁËÕâЩÐÅÏ¢¾ÍÄܶԷ¢ËÍÕß½øÐз´À¡¡£
¾ßÌå¿ÉÒԲο´ÊéÖиø³öµÄʹÓÃʾÀý£º
//: Dgram.java
// A utility class to convert back and forth
// Between Strings and DataGramPackets.
import java.net.*;
public class Dgram {
public static DatagramPacket toDatagram(String s, InetAddress destIA, int dest
Ïà¹ØÎĵµ£º
ÏÂÃæÊdz£Óô¦ÀíÈÕÆڵķ½·¨£¬Ï£Íû¶Ô´ó¼ÒÓÐÓã¡
ÔÚÎÒ ......
1. RabbitÁ÷ÃÜÂ루Rabbit Stream Cipher£©¼ò½é
RabbitÁ÷ÃÜÂëÊÇÓÉCryptico¹«Ë¾£¨http://www.cryptico.com£©Éè¼ÆµÄ£¬ÃÜÔ¿³¤¶È128룬
×î´ó¼ÓÃÜÏûÏ¢³¤¶ÈΪ264 Bytes£¬¼´16 TB£¬ÈôÏûÏ¢³¬¹ý¸Ã³¤¶È£¬ÔòÐèÒª¸ü»»ÃÜÔ¿¶ÔʣϵÄÏûÏ¢½øÐд¦Àí¡£ËüÊÇÄ¿Ç°°²È«ÐԽϸߣ¬¼Ó/½âÃÜËٶȱȽϸßЧµÄÁ÷ÃÜÂëÖ®Ò»£ ......
XMLÎļþÊÇÒ»ÖÖ¿ÉÀ©Õ¹ÐÔ±êʶÓïÑÔ,xmlÎļþµÄÖ÷ÒªÓÃ;:
×öweb¿ª·¢Ê±,¿ÉÒÔÓÃxmlÎļþÀ´×öϵͳµÄÅäÖÃ
ϵͳµÄ¼¯³É
Êý¾ÝµÄÖÐת
ÒòΪxmlÎļþÊÇ¿çƽ̨µÄ,ËùÒÔ¶ÔÓ겻ͬµÄϵͳ֮¼äµÄÊý¾ÝµÄ´«ËÍ,½»»¥¿ÉÒÔÓÃxmlÎļþÀ´ÊµÏÖ
ÏÂÃæµÄÕâ¸öÏîÄ¿Ö÷ÒªÊÇÓÃÀ´:
1,½«oracleÊý¾Ý¿âÖеÄemp±íµÄ½á¹¹¶ÁÈ¡,²¢ÇÒÉú³ÉxmlÎļþ,²¢ÇÒ½«±íÖеÄÊý¾Ýͬ ......
public class Path {
//get class absolute address
public String getPath() {
String classPath = getClass().getName();
if (classPath.indexOf(".") != -1) {
classPath = classPath.substring(classPath.lastIndexOf(".") + 1,
......
ÒÔO(n)µÄʱ¼äʵÏÖ¶ÔÕýÕûÊýµÄÅÅÐò¡£Ë¼Â·ÊÇ£º´Ó×îĩλ¿ªÊ¼£¬¶ÔÊý×éÖÐÿһ¸öÊýµÄµÚkλ½øÐмÆÊýÅÅÐò£¬Ö±µ½Åŵ½×î¸ßλΪֹ¡£
ȱµã£ºÖ»ÄܶÔÕýÕûÊý½øÐÐÅÅÐò£¬¶øÇÒÐèÒªÖªµÀ×î´óÕûÊýµÄ×î¸ßλ£¬Ê¹Ó÷¶Î§Ì«Ð¡¡£µ«ÕⲻʧΪһ¸öºÜÓÐȤµÄÅÅÐò£¬ÒòΪËüµß¸²Á˱ȽÏÅÅÐòµÄ´«Í³Ë¼Â·¡£
public static int[] radixSort(int[] inputs,int d){
......