Java UDPͨѶ³ÌÐòÉý¼¶°æ
×î½üÒ»Ö±ÔÚдC#µÄUDPͨѶ·½ÃæµÄ³ÌÐò£¬³é¿Õ°ÑÒÔǰдµÄJavaµÄUDPͨѶ³ÌÐòÄóöÀ´×öÁËһЩÉý¼¶µÄÐ޸ģ¬°ÑÒÔǰһЩ²»×ãµÄµØ·½×öÁ˸Ķ¯£¬Í¬Ê±Ê¹ÓÃexe4jÈí¼þ±àÒë³ÉexeÎļþ£¬Èí¼þЧ¹ûÈçÏÂËùʾ£º
ͬʱ°Ñ´úÂëÌù³öÀ´£¬ÒÔ¹©´ó¼ÒÖ¸µãÒ»¶þ¡£
Main.java(Ö÷º¯Êý)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jappudp;
/**
*
* @author AlimysoYang
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
UdpFrame udpframe = new UdpFrame();
}
}
UdpFrame.java(´°¿Úµ¥Ôª)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jappudp;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
*
* @author AlimysoYang
* @version 1.0.1
*/
public class UdpFrame extends JFrame implements ActionListener
{
//³õʼ»¯´°¿Ú¿Ø¼þ
private JLabel lbRecvPort = new JLabel("½ÓÊն˿Ú",JLabel.LEFT);
private JLabel lbSendIP = new JLabel("·¢ËÍIP",JLabel.LEFT);
private JLabel lbSendPort = new JLabel("·¢ËͶ˿Ú",JLabel.LEFT);
private JLabel lbRecv = new JLabel("½ÓÊÕÊý¾Ý",JLabel.LEFT);
private JLabel lbSend = new JLabel("·¢ËÍÊý¾Ý",JLabel.LEFT);
private JLabel lbInfo = new JLabel("",JLabel.LEFT);
private JLabel lbVersion = new JLabel("AlimysoYang (for NetBeans) v1.01",JLabel.LEFT);
private JTextField tfRecvPort = new JTextField("8800",6);
private JTextField tfSendIP = new JTextField("127.0.0.1",15);
private JTextField tfSendPort = new JTextField("8801",6);
Ïà¹ØÎĵµ£º
try {
Runtime.getRuntime().exec("C:\\xxx.exe");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} ......
ÔÎÄ£ºhttp://csharpindepth.com/Articles/Chapter5/Closures.aspx
µÚÒ»¶ÎÂÔ¡£¡£¡£
´ó¶àÊý½²±Õ°üµÄÎÄÕ¶¼ÊÇ˵º¯ÊýʽÓïÑÔ£¬ÒòΪËüÃÇÍùÍù¶Ô±Õ°üµÄÖ§³Ö×îÍêÉÆ¡£µ±ÄãÔÚʹÓú¯ÊýʽÓïÑÔʱ£¬ºÜ¿ÉÄÜÒѾÇå³þÁ˽âÁËʲôÊDZհü£¬ËùÒÔÎÒÏëдһƪÔÚ¾µäOOÓïÑÔ³öÏֵıհüÓÐʲôÓô¦Ó¦¸ÃÒ²ÊǺܺÏÊʵÄÊÂÇé¡£ÕâƪÎÄÕÂÎÒ×¼±¸½²Ò»ÏÂC#£¨1¡ ......
ÏÂÃæÊÇJavaÏß³ÌϵÁв©ÎĵÄÒ»¸ö±àÄ¿£º
JavaỊ̈߳º¸ÅÄîÓëÔÀí
JavaỊ̈߳º´´½¨ÓëÆô¶¯
JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿
JavaỊ̈߳ºÏß³Ì״̬µÄת»»
JavaỊ̈߳ºÏ̵߳Äͬ²½ÓëËø
JavaỊ̈߳ºÏ̵߳Ľ»»¥
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÐÝÃß
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÓÅÏȼ¶
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-Èò½
......
µÚһ֪ʶµã£º¹¹ÔìÆ÷£¬¹¹ÔìÆ÷ºÍÀàÃûÒ»Ö£¬ÎÞ·µ»ØÖµ£¬ÔÚjavaÖГ³õʼ»¯”Óë“´´½¨”ÊÇÁ¬ÔÚÒ»ÆðµÄ£¬ËùÒÔÎÒÃǾ³£Óù¹ÔìÆ÷ÔÚ´´½¨¶ÔÏóµÄʱºòÀ´³õʼ»¯ÀàµÄһЩʵÀý¡£ÌØÊâ˵Ã÷£ºnew±í´ïʽ·µ»ØÁ˶Ôн¨¶ÔÏóµÄÒýÓ㬵«Êǹ¹ÔìÆ÷±¾ÉíûÓзµ»ØÈκÎÖµ¡£
µÚ¶þ¸ö֪ʶµã£º·½·¨µÄÖØÔØ£¬Ãû³ÆÏàͬ£¬²ÎÊý²»Í¬µÄ·½·¨½Ð×ö· ......