亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? transceiverhard.java

?? 一個(gè)多機(jī)器人的仿真平臺(tái)
?? JAVA
字號(hào):
/* * TransceiverHard.java */package EDU.gatech.cc.is.communication;import java.util.Enumeration;import java.io.*;import java.net.*;import RoboComm.RoboComm;import EDU.gatech.cc.is.util.*;/** * The TransceiverHard class implements the Transceiver interface * so a robot can communicate. * <P> * <A HREF="../COPYRIGHT.html">Copyright</A> * (c)1998 Tucker Balch * * @author Tucker Balch * @version $Revision: 1.1 $ */public class TransceiverHard implements Transceiver, Runnable	{        /**         * The maximum number of messages the receive buffer can hold.         */        public static final int BUF_SIZE = 100; // size of the receive buffer        /**         * Circular buffer for messages.         */        private CircularBuffer messagebuf =                               new CircularBuffer(BUF_SIZE);	/**	 * Indicates whether done or not	 */	private boolean done = false;	/**	 * The thread receiving messages.	 */	private Thread th = null;	/**	 * Indicates whether communication has been enabled, e.g. we are	 * connected with the server.	 */	private boolean enabled = false;	/**	 * The id of this agent.	 */	private int id = -1;	/**	 * Input.	 */        ObjectInputStream in = null;	/**	 * Output.	 */        ObjectOutputStream out = null;	/**	 * The socket to the server.	 */	Socket sock = null;	/**	 * Make a real transceiver object.	 * @param s String, the server host.	 * @param i int, the robot id.	 */	public TransceiverHard(String s, int i)		{		/*--- record the id ---*/		id = i;		/*--- try to connect to the server ---*/                try                        {                        sock = new Socket(s,RoboComm.LISTEN_PORT);			enabled = true;                        }                catch (IOException e)                        {                        System.out.println("TransceiverHard:"+				" Unable to connect to "+s+                                " on port "+RoboComm.LISTEN_PORT+" due to ");                        System.out.println(e);                        System.out.println("Maybe the "+                                "RoboComm server is not running.");			enabled = false;                        }		/*--- open the socket for sending messages ---*/                // note: can't open receive socket yet because it blocks		if (enabled)			{                	try                        	{                        	out =                                	new ObjectOutputStream(                                        	new BufferedOutputStream(                                                sock.getOutputStream()));                        	}                	catch (Exception e)                        	{                        	System.out.println("TransceiverHard: "+e);				enabled = false;                        	}			}                /*--- register id with the server ---*/                try                        {			if (enabled)				{                        	RegisterMessage m = new RegisterMessage(id);                        	out.writeObject(m);                        	out.flush();				}                        }                catch (Exception e)                        {                        System.out.println("TransceiverHard: "+e);			enabled = false;                        }                /*--- open receive socket ---*/                try                        {			if (enabled)				{                        	in = new ObjectInputStream(                                        new BufferedInputStream(                                                sock.getInputStream()));				}                        }                catch (Exception e)                        {                        System.out.println("TransceiverHard: "+e);			enabled = false;                        }		if (enabled)			{               		System.out.println("TransceiverHard: connected "+				"to RoboComm server as client "+id);			}		else               		System.out.println("TransceiverHard: "+				"unable to connect.");		/*--- start the thread running ---*/		if (enabled)			{			th = new Thread(this);			th.start();			}		}	/**	 * Thread to monitor incoming messages.	 */	public void run()		{                Message m = null;		while (!done)                        {                        try                                {                                m = (Message)in.readObject();				messagebuf.put(m);                                }                        catch(Exception e)                                {                                System.out.println(e);				done = true;				enabled = false;                                }			try {Thread.yield();}			catch(Exception e){}                        }		}	/**	 * Broadcast a message to all teammates, except self.	 * @param m Message, the message to be broadcast.	 */	public synchronized void broadcast(Message m)		{		m.type = m.BROADCAST;                try                        {                        if (enabled) 				{				out.writeObject(m);                        	out.flush();				}                        }                catch (Exception e)                        {                        System.out.println("TransceiverHard.broadcast: "+e);			enabled = false;			done = true;                        }		}	/**	 * Transmit a message to just one teammate.  Transmission to	 * self is allowed.	 * @param i int, the ID of the agent to receive the message.	 * @param m Message, the message to transmit.	 * @exception CommunicationException if the receiving agent does not	 *		exist.	 */	public synchronized void unicast(int i, Message m) 		throws CommunicationException		{		m.type = m.UNICAST;		m.receivers = new int[1];		m.receivers[0] = i;                try                        {                        if (enabled) 				{				out.writeObject(m);                        	out.flush();				}                        }                catch (Exception e)                        {                        System.out.println("TransceiverHard.unicast: "+e);			enabled = false;			done = true;                        }		}	/**	 * Transmit a message to specific teammates.  Transmission to	 * self is allowed.	 * @param ids int[], the IDs of the agents to receive the message.	 * @param m Message, the message to transmit.	 * @exception CommunicationException if one of the receiving agents 	 *		does not exist. NOT IMPLEMENTED.	 */	public synchronized void multicast(int[] ids, Message m)		throws CommunicationException		{		m.type = m.MULTICAST;		m.receivers = ids;                try                        {                        if (enabled) 				{				out.writeObject(m);                        	out.flush();				}                        }                catch (Exception e)                        {                        System.out.println("TransceiverHard.multicast: "+e);			enabled = false;			done = true;                        }		}	/**	 * Get an enumeration of the incoming messages.  The messages	 * are automatically buffered for you.	 * Since this is implemented as a circular you cannot	 * count on all messages being delivered unless you read from	 * the buffer faster than messages are received.	 * Example, to print all incoming messages:	 * <PRE>	 * Transceiver c = new TranscieverHard();	 * Enumeration r = c.getReceiveChannel();	 * while (r.hasMoreElements()) 	 * 	System.out.println(r.nextElement());	 * </PRE>	 * @return the Enumeration.	 */	public CircularBufferEnumeration getReceiveChannel()		{		return(messagebuf.elements());		}	/**	 * NOT IMPLEMENTED	 * Set the maximum range at which communication can occur.	 * In simulation, this corresponds to a simulation of physical limits,	 * on mobile robots it corresponds to a signal strength setting.	 * @param r double, the maximum range.	 */	public void setCommunicationMaxRange(double r)		{		}	/**	 * Check to see if the transceiver is connected to the server.	 */	public synchronized boolean connected()		{		return(enabled);		}	/**	 * quit.	 */	public synchronized void quit()		{		done = true;		enabled = false;		th.stop();		}	/**	 * Code to test the communication system.	 */        public static void main(String[] args)                {                String server_host = "localhost";                int num = 0;                /*--- announce ---*/                System.out.println("TransceiverHard demonstration");                /*--- check arguments ---*/                try                        {                        num = Integer.parseInt(args[0]);                        }                catch (Exception e)                        {                        System.out.println(                                "usage: Client num [server_host]");                        }                if (args.length == 2)                        {                        server_host = args[1];                        }                else if (args.length > 2)                        {                        System.out.println("usage: Client num [server_host]");                        System.exit(1);                        }		/*--- make the transceiver ---*/		TransceiverHard t = new TransceiverHard(server_host, num);		}	}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久精品日韩欧美| 国产在线精品免费| 精品国产99国产精品| 91亚洲男人天堂| 韩国精品在线观看| 天天av天天翘天天综合网| 国产精品国产自产拍高清av| 日韩欧美的一区| 欧美色图12p| 91色.com| www.在线欧美| 国产成人三级在线观看| 美女网站视频久久| 丝袜亚洲精品中文字幕一区| 亚洲日本免费电影| 国产精品视频第一区| 亚洲精品一区二区精华| 51午夜精品国产| 欧美日韩一区二区三区高清| 成人av在线资源网站| 精品夜夜嗨av一区二区三区| 日本欧美一区二区三区| 一区二区激情小说| 曰韩精品一区二区| 亚洲色欲色欲www| 日本一区二区不卡视频| 国产视频一区在线播放| 精品国产网站在线观看| 日韩欧美久久久| 欧美一区二区人人喊爽| 欧美久久久久久久久中文字幕| 在线亚洲精品福利网址导航| 色偷偷久久一区二区三区| 99re这里只有精品视频首页| 99久久久无码国产精品| 不卡一区二区在线| 99精品欧美一区二区蜜桃免费| 国产69精品一区二区亚洲孕妇| 国产精品一区二区免费不卡| 国产成人av资源| 成人在线视频首页| 99精品欧美一区二区三区小说| 99re成人在线| 在线视频国内一区二区| 欧美精品一卡两卡| 日韩欧美国产电影| 久久天天做天天爱综合色| 久久久亚洲国产美女国产盗摄| 国产性色一区二区| 国产精品美女视频| 伊人一区二区三区| 亚洲bt欧美bt精品777| 奇米影视7777精品一区二区| 久久成人av少妇免费| 国产一区二区导航在线播放| 国产69精品久久777的优势| 99久久777色| 欧美巨大另类极品videosbest| 日韩欧美第一区| 国产精品污网站| 亚洲综合激情小说| 久久国产精品72免费观看| 国产精品一区二区在线播放| 波多野结衣中文字幕一区| 精品少妇一区二区三区在线视频 | 国产精品一区免费在线观看| 国产成人鲁色资源国产91色综 | 一区二区免费在线| 日韩av网站在线观看| 激情文学综合插| av电影天堂一区二区在线| 欧美午夜电影网| 久久蜜臀中文字幕| 一区二区三区四区蜜桃| 狠狠v欧美v日韩v亚洲ⅴ| 成人av资源网站| 69久久夜色精品国产69蝌蚪网| 久久综合久久99| 亚洲免费资源在线播放| 捆绑调教一区二区三区| 97成人超碰视| 欧美成人女星排行榜| 亚洲美女区一区| 久久精品国产色蜜蜜麻豆| kk眼镜猥琐国模调教系列一区二区 | 亚洲黄色小说网站| 激情深爱一区二区| 在线观看日产精品| 久久影院电视剧免费观看| 亚洲精品乱码久久久久久久久| 免费观看在线色综合| 99精品热视频| 久久久久久久久蜜桃| 亚洲无人区一区| 不卡高清视频专区| 亚洲精品在线观看网站| 亚洲一级二级三级在线免费观看| 国产精品99久久久| 8x8x8国产精品| 亚洲精品欧美激情| 成人一区二区三区在线观看| 91精品国产综合久久福利| 亚洲欧美日韩国产综合在线| 国产一区二区三区综合| 欧美日韩精品欧美日韩精品一综合| 亚洲国产精品二十页| 激情综合色播激情啊| 欧美午夜精品一区| 亚洲视频电影在线| 国产成人精品亚洲777人妖 | 日本不卡中文字幕| 在线观看视频一区| 中文字幕人成不卡一区| 国产乱对白刺激视频不卡| 91麻豆精品国产91久久久资源速度| 亚洲天堂成人网| 成人高清视频在线| 国产日韩在线不卡| 国产一区二区三区免费看| 91精品国产综合久久婷婷香蕉 | 一区二区三区视频在线看| 大胆欧美人体老妇| 国产日产亚洲精品系列| 久久精品国产久精国产爱| 777午夜精品免费视频| 亚洲一区二区中文在线| 91九色最新地址| 亚洲一区在线看| 91极品美女在线| 亚洲国产中文字幕在线视频综合| 91丨porny丨国产| 亚洲丝袜精品丝袜在线| 91一区二区三区在线观看| 亚洲欧洲日韩女同| 91啪在线观看| 国产精品传媒入口麻豆| 91伊人久久大香线蕉| 亚洲美女电影在线| 在线观看一区日韩| 亚洲国产精品一区二区www| 欧美中文字幕亚洲一区二区va在线| 一个色妞综合视频在线观看| 欧美性一区二区| 亚洲bdsm女犯bdsm网站| 在线电影国产精品| 麻豆精品精品国产自在97香蕉| 日韩三级在线观看| 国产在线一区二区| 国产日韩欧美不卡在线| 成人av在线影院| 一区二区三区四区在线免费观看| 欧美性做爰猛烈叫床潮| 日韩高清不卡在线| 精品国产精品网麻豆系列| 国产精品66部| 亚洲欧美激情在线| 欧美日韩亚洲丝袜制服| 久久精品国内一区二区三区| 精品国产99国产精品| 成人ar影院免费观看视频| 亚洲另类春色校园小说| 欧美精品欧美精品系列| 精品中文字幕一区二区小辣椒| 久久女同性恋中文字幕| 91在线高清观看| 欧美aaaaaa午夜精品| 国产日韩精品久久久| 欧美中文字幕不卡| 九九热在线视频观看这里只有精品| 欧美国产精品久久| 欧美日韩一区在线| 国产夫妻精品视频| 亚洲一区在线观看免费观看电影高清| 777久久久精品| 成人晚上爱看视频| 日韩精品亚洲专区| 中文字幕第一区综合| 欧美精品亚洲二区| 成人午夜激情视频| 全国精品久久少妇| 亚洲欧美另类久久久精品2019| 欧美一级二级三级乱码| 成人av在线影院| 久草中文综合在线| 亚洲精品va在线观看| 久久蜜桃一区二区| 欧美日韩三级一区| 成人午夜视频福利| 五月天欧美精品| 日韩一区有码在线| 久久亚洲一区二区三区四区| 在线精品视频一区二区| 国产91精品一区二区| 免费黄网站欧美| 亚洲成a人片综合在线| 中文字幕在线观看不卡| 亚洲精品在线三区| 91麻豆精品国产91| 91久久精品国产91性色tv| 豆国产96在线|亚洲|