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

java UDPģʽͨѶʵÀý javaѧϰ±Ê¼Ç(5)

Ò»°ãʹÓÃsocket½¨Á¢µÄÁ¬½Ó¶¼ÊôÓÚTCPÁ¬½ÓµÄģʽ..¾ÍÊÇÒ»°ãҪͨ¹ýÈý´ÎÎÕÊÖÀ´½¨Á¢session..È»ºóÔÙ´«ËÍÊý¾Ý..
¶øUDPģʽ²»Í¬µÄµØ·½ÔÚÓÚ..Ëü²»ÐèÒª½¨Á¢ºÍËûÈ˵ÄÁ¬½Ó..¶øÊÇÖ±½ÓÍùһ̨Ö÷»úµÄijһ¸ö¶Ë¿ÚÉÏ·¢ËÍÊý¾Ý±¨ÎÄ..
¶ÔÓÚһЩ¶ÔͨÐÅÖÊÁ¿ÒªÇ󲻸߻òÕß˵Êý¾ÝÏ¡ÊèµÄͨÐÅÀ´Ëµ..ÓÃUDPģʽÊÇÒ»¸ö²»´íµÄÑ¡Ôñ..
ÏÂÃæÊÇÒ»¸öÓÃjavaʵÏÖµÄÁÄÌìͨѶµÄ³ÌÐòʵÀý:
·¢ËͶ˴úÂë..ÓÃÀ´ÏìÓ¦Óû§µÄÊäÈë²¢½«ÄÚÈÝ·¢Ë͸ø¶Ô·½..
class UDPSendThread extends Thread {//ÓÉÏß³ÌÀ´ÊµÏÖ
public DatagramPacket dp = null;//Êý¾Ý±¨°ü..
public DatagramSocket ds = null; //Êý¾Ý±¨°üµÄÌ×½Ó×Ö..
UDPSendThread(DatagramPacket dp, DatagramSocket ds) {
this.dp = dp;
this.ds = ds;
this.start();
}
@Override
public void run() {
try {
BufferedReader keyIn = new BufferedReader(new InputStreamReader(System.in));//Óû§ÊäÈëÊý¾Ý
String s;
while (true) {
s = keyIn.readLine();//×èÈû³ÌÐò..Ö±µ½Óû§ÊäÈëÐÅÏ¢
dp.setData(s.getBytes());//ÓÃÓû§ÊäÈëµÄÐÅÏ¢À´ÉèÖÃÊý¾Ý±¨°ü
System.out.println("You: "+s);
ds.send(dp);//ÓÃÊý¾Ý±¨°üµÄÌ×½Ó×ÖÀ´·¢ËÍÊý¾Ý±¨°ü..
if ( s.trim().equals("BYE") ) break;//Èç¹ûÓû§ÊäÈëÐÅϢΪ"BYE"Ôò½áÊøÍ¨ÐÅ..
}
keyIn.close();
ds.close();
}
catch(Exception e) {
System.out.println("Error: Send: "+e);
}
}

½ÓÊÕ¶Ë´úÂë..ÓÃÀ´¼àÌý¶Ë¿Ú..½«ÊÕµ½µÄÐÅÏ¢ÏÔ³ö³öÀ´..
class UDPRecvThread extends Thread {//Ïß³ÌʵÏÖ
public DatagramPacket dp = null;//Êý¾Ý±¨°ü
public DatagramSocket ds = null; //Êý¾Ý±¨°üµÄÌ×½Ó×Ö
UDPRecvThread(DatagramPacket dp, DatagramSocket ds) {
this.dp = dp;
this.ds = ds;
this.start();
}
@Override
public void run() {
try {


Ïà¹ØÎĵµ£º

java cstÊ±Çø×ª»»


BODY { color: #000000; font-size: 9pt; font-family: ËÎÌå }
TABLE { font-size: 9pt; font-family: ËÎÌå }
SimpleDateFormat sdfy = new SimpleDateFormat("HH:mm"); 
        String tt =
"Tue Feb 09 10:43:00 CST 2010";
   &n ......

JAVAÐòÁл¯

JAVAµÄÐòÁл¯API£¬ËüÌṩÁËÒ»¸ö¿ò¼Ü£¬ÓÃÀ´½«¶ÔÏó±àÂë³ÉÒ»¸ö×Ö½ÚÁ÷£¬ÒÔ¼°´Ó×Ö½ÚÁ÷±àÂëÖÐÖØÐ¹¹½¨¶ÔÏó¡£½«Ò»¸ö¶ÔÏó±àÂë³ÉÒ»¸ö×Ö½ÚÁ÷£¬Õâ¸öÊÇÐòÁл¯¹ý³Ì£¬·´¹ýÀ´¾ÍÊÇ·¹ÐòÁл¯¡£Ò»µ©Ò»¸ö¶ÔÏó±»ÐòÁл¯ºó£¬ÔòËüµÄ±àÂë¿ÉÒÔ´ÓÒ»¸öÕýÔÚÔËÐеÄÐéÄâ»ú±»´«µÝµ½ÁíÍâÒ»¸öÐéÄâ»úÉÏ£¬»òÕß±»´æ´¢ÔÚ´ÅÅÌÉÏ£¬¹©ÒÔºó·´ÐòÁл¯Ê¹Óá£ÐòÁл¯¼¼ÊõÎªÔ ......

javaͬһÓû§µÇ¼ÎÊÌâ

javaͬһÓû§µÇ¼ÎÊÌâ
1.ÉϸöÔÂÒ²ÓÐÌÖÂÛÕâ¸öÎÊÌâµÄ,ÓкöàÈ˶¼·¢±íÁËÒâ¼û,µ«Ò²Ã»Óбê×¼µÄ´ð°¸
ÎÒ¿´µ½Ò»¸ö,:½«SEssionID´æÈëDBÖÐ,µ±ÄãµÇ¼ʱ,Åжϵ±Ç°µÄSEssionIDºÍDB
ÀïÊDz»ÊÇͬһ¸ö,Èç¹û²»ÊÇ,˵Ã÷ÊǵڶþÈ˵ǼÁË,ÄǾͽ«DBÀïµÄSESSIONID×¢Ïú
È»ºóÔÙ´¦ÀíµÚ¶þ¸öµÇ¼.
2.ÔÚContextÖн¨Á¢Ò»¸öMap <String,Sission>,´ ......

XULRunner with Java: JavaXPCOM Tutorial 2

4 ÔÚjava´úÂëÀïǶÈëFirefox3
  ÏÖÔÚ¿ÉÒÔÈ¥ÓÃÒ»ÏÂÓÐÓõÄÀý×ÓÁË¡£Ê×ÏÈÎÒÃÇÔÚÒ»¸öjava³ÌÐòÀïʹÓÃSWTÀ´Ç¶ÈëÒ»¸öMozillaä¯ÀÀÆ÷¡£ÏÖÔÚ£¬ÎÒÃÇ¿ÉÒÔʹÓÃ
org.eclipse.swt.browser.BrowserÀàÀ´ÊµÀý»¯£ºbrowser = new Browser(shell, SWT.MOZILLA); ÔÚÕâ֮ǰ£¬ÎÒÃÇÐèҪʹÓÃATFÏîÄ¿
£¬ÒÔ¼°Ò»ÏÂATF²å¼þ¡£·Ç³£ÐÒÔË£¬ÏÖÔÚÎÒÃDz»ÐèÒ ......

Java Swing LayoutManager


BorderLayout
FlowLayout
GridLayout
GridBagLayout
CardLayout
BoxLayout  



< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ