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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mysend.java

?? jxme的一些相關程序,主要是手機上程序開發以及手機和計算機通信的一些程序資料,程序編譯需要Ant支持
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/************************************************************************
 *
 * Copyright (c) 2002 Sun Microsystems, Inc.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *       Sun Microsystems, Inc. for Project JXTA."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA"
 *    must not be used to endorse or promote products derived from this
 *    software without prior written permission. For written
 *    permission, please contact Project JXTA at http://www.jxta.org.
 *
 * 5. Products derived from this software may not be called "JXTA",
 *    nor may "JXTA" appear in their name, without prior written
 *    permission of Sun.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL SUN MICROSYSTEMS OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Project JXTA.  For more
 * information on Project JXTA, please see
 * <http://www.jxta.org/>.
 *
 * This license is based on the BSD license adopted by the Apache
 * Foundation.
 **********************************************************************/

/**
 * Sample code illustrating PeerNetwork.send() 
 */
package tutorial;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import net.jxta.j2me.PeerNetwork;
import net.jxta.j2me.Message;
import net.jxta.j2me.Element;

/**
 * This example illustrates using the JXTA for JXME APIs to send and
 * receive messages.
 *
 * This example creates an instance of 
 * {@link PeerNetwork PeerNetwork} and connects to the JXTA network, creates
 * a pipe, and issues a search request looking for this pipe. It next polls
 * for messages until it receives a response that the pipe has been found,
 * and then sends a message to this pipe (essentially talking to itself).  
 * Finally, it polls for messages again and displays the messages it receives.
 * 
 * The usage for running the application is:
 * <pre>
 *     mySend [-relay <i>relay</i>]
 * </pre>
 * where <tt>relay</tt> is the URL of the JXTA for J2ME relay hosts
 * (for example, <tt>http://209.25.154.233:9700</tt>). If no relay is
 * specified on the command line, the application attempts to use the
 * localhost as the relay.
 * 
 * Sample output when this application is run: 
 * <pre>
 * relay url: http://209.25.154.233:9700
 * listen query id: 0
 * start polling for pipeID...
 * got pipeID
 * send request id: 1
 * start polling for incoming messages...
 * Message from: mySendPeer
 * Message: Hello there
 * </pre>
 */

public class mySend {
    
    private static final String USAGE =
        "\nUsage: mySend [-relay relay]" +
        "\n" +
        "options:\n" +
        "  -relay    http relay URL\n";
    
    private static final String PEER_NAME = "mySendPeer"; 
    private static final String PIPE_NAME = "myPipe";
    private static final String PIPE_TYPE = PeerNetwork.UNICAST_PIPE;
    
    private PeerNetwork peer = null;
    private String relayUrl = null;
    private byte[] persistentState = null;
    private int listenQueryId = -1;
    private int sendRequestId = -1;
    
    /**
     * Constructor for the mySend object.
     *
     * First, create a new instance of
     * {@link PeerNetwork} with the specified name and connect
     * to the JXTA relay. A connection to the relay needs to be established
     * before any other operations can be invoked.
     * <pre>
     *    peerNetwork = PeerNetwork.createInstance(PEER_NAME);
     *    persistentState = peerNetwork.connect(relayUrl, persistentState);
     * </pre>
     *
     * In this example, we do not use
     * persistentState again. However, in a real application, this value
     * should be persisted and passed back on subsequent calls to
     * {@link net.jxta.j2me.PeerNetwork#connect connect()}
     * so that the peer can be identified and it
     * can receive any messages that have been queued in its absence.
     *
     * Next, we create and open a Unicast pipe named after the peer:
     * <pre>
     *     listenQueryId = peerNeetwork.listen(PIPE_NAME, null, PIPE_TYPE);
     * </pre> 
     *
     * The call to <code>listen()</code> takes three arguments:
     * <ul>
     * <li> String name - Name of the pipe
     * <li> String id - Pipe ID
     * <li> String type - Type of pipe (
     * {@link net.jxta.j2me.PeerNetwork#UNICAST_PIPE PeerNetwork.UNICAST_PIPE} or
     * {@link net.jxta.j2me.PeerNetwork#PROPAGATE_PIPE PeerNetwork.PROPAGATE_PIPE})
     * </ul>
     *
     * Because we pass a null Pipe ID, a new pipe will be created for
     * us. The Pipe ID for this new pipe will be returned asynchronously
     * in a response message. We will also receive an asynchronous
     * response indicating the status of this call to
     * <code>listen()</code> -- whether it completed successfully or an
     * error occurred.  In this example, we are ignoring these responses.
     * <p></p>
     * Next, we have our peer search for this pipe and send it a message.
     * {@link #findMyPipe} waits until it finds the pipe and then returns
     * the pipe ID. The method {@link #sendMyMessage sendMymessage()} 
     * uses this pipeID to send the message:
     * <pre>
     *     String pipeId = findMyPipe();
     *     sendMyMessage(pipeId);
     * </pre>
     *
     * Finally, we call {@link #recvMessage} to poll for and display the
     * message that was sent to this peer. Because {@link #recvMessage} loops forever
     * polling for messages, this application never exits.
     * <pre>
     *     recvMessage();
     * </pre>
     */

    public mySend(String relay) throws IOException {
        relayUrl = relay;
        
        System.out.println("relay url: " + relayUrl);
        
        // Create a peer and have it connect to the relay.
        // A connection to relay is required before any other
        // operations can be invoked.
        peer = PeerNetwork.createInstance(PEER_NAME);
        persistentState = peer.connect(relayUrl, persistentState);
        
        // Have the peer create and open a Unicast pipe; PipeID will
        // be returned asynchronously in a response message
        listenQueryId = peer.listen(PIPE_NAME, null, PIPE_TYPE);
        System.out.println("listen query id: " + listenQueryId);
        
        // Have peer search for this Pipe and then send it a Message
        String pipeID = findMyPipe();
        sendMyMessage(pipeID);
        
        // Finally, have the peer poll for Messages sent to it
        recvMessage();
    }
    
    /**
     * Search for a pipe with the given name, waiting
     * (possibly forever) until the pipe is found.<p></p>
     *
     * This method polls for messages addressed to this peer. We should
     * receive messages in response to our call to listen() -- messages
     * providing information about the pipe and indicating if the pipe was
     * successfully created. These messages will contain an Element named
     * {@link net.jxta.j2me.Message#REQUESTID_TAG} whose data matches our
     * searchQueryId. <p></p>
     *
     * In this example, we ignore all messages except for those that match
     * our searchQueryId. When we receive a matching message, we return the
     * pipe id. <p></p>
     *
     * First, we poll for messages that were sent to this peer. This method
     * takes one argument, which is the timout in milliseconds. (A timeout
     * value of 0 would indicate that the poll operation should wait forever):
     * <pre>
     *     msg = peer.poll(1);
     * </pre>
     *
     * For each message that is received, we loop through all elements:
     * <pre>
     *     for (int i = 0; i < msg.getElementCount(); i++) {
     *          Element e = msg.getElement(i);
     * </pre>
     *
     * We are expecting a message in response to our search request. This message
     * will contain elements in the {@link net.jxta.j2me.Message#PROXY_NAME_SPACE}
     * with the following names:
     * <ul>
     * <li>{@link net.jxta.j2me.Message#REQUESTID_TAG} -- The request ID; we're
     * looking for one that matches our searchRequestId.
     * <li>{@link net.jxta.j2me.Message#TYPE_TAG} -- Type of JXTA component; can be
     * {@link net.jxta.j2me.PeerNetwork#PIPE}, {@link net.jxta.j2me.PeerNetwork#PEER},
     * or {@link net.jxta.j2me.PeerNetwork#GROUP}. We're expecting 
     * {@link net.jxta.j2me.PeerNetwork#PIPE}.
     * <li>{@link net.jxta.j2me.Message#NAME_TAG} -- The name of the JXTA component;
     * we're expecting our PIPE_NAME.
     * <li>{@link net.jxta.j2me.Message#ARG_TAG} -- Argument; in this example, we're
     * expecting the type of our  pipe, PIPE_TYPE.
     * <li>{@link net.jxta.j2me.Message#ID_TAG} -- The JXTA ID; in this example,
     * we're expecting the JXTA pipe ID.
     * </ul>
     * <p></p>
     * We first check if this element is using the 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人高清在线视频| 欧美日韩国产综合一区二区三区| 99热国产精品| 日韩一级免费观看| 亚洲免费观看高清完整版在线观看| 亚洲电影第三页| 色综合中文综合网| 亚洲另类在线制服丝袜| 久久99精品久久久| 欧美精品在线视频| 亚洲欧美日韩电影| 成人中文字幕在线| ww亚洲ww在线观看国产| 亚洲成国产人片在线观看| 99在线精品视频| 国产婷婷色一区二区三区在线| 五月开心婷婷久久| 91福利在线免费观看| 中文字幕一区二区三区乱码在线 | 欧美一区二区三区系列电影| 亚洲欧美另类图片小说| 成人福利电影精品一区二区在线观看| 91精品啪在线观看国产60岁| 一区二区三区成人| 色综合天天综合色综合av | 欧美精品亚洲二区| 洋洋成人永久网站入口| 91年精品国产| 亚洲色大成网站www久久九九| 成人久久视频在线观看| 国产婷婷色一区二区三区四区 | www成人在线观看| 免费av成人在线| 日韩欧美一区在线| 老司机精品视频线观看86| 91精品国产黑色紧身裤美女| 日韩不卡手机在线v区| 欧美丰满一区二区免费视频 | 国产成人免费9x9x人网站视频| 精品蜜桃在线看| 国产精品自拍av| 欧美激情自拍偷拍| 99国产精品99久久久久久| 亚洲欧美综合在线精品| 一本在线高清不卡dvd| 亚洲精品免费在线| 欧美日本在线看| 美女视频黄 久久| 久久久噜噜噜久噜久久综合| 国产精品正在播放| 一区在线观看视频| 欧美在线看片a免费观看| 午夜婷婷国产麻豆精品| 日韩精品一区二| 粉嫩高潮美女一区二区三区 | 国产色产综合产在线视频| 从欧美一区二区三区| 中文字幕欧美一| 欧美日韩一区二区三区不卡| 久久精品99国产精品日本| 久久精品免费在线观看| 99久久婷婷国产综合精品| 亚洲国产一区二区三区青草影视 | 久久福利资源站| 日本一二三不卡| 欧美这里有精品| 麻豆精品视频在线观看视频| 国产三级久久久| 欧美色欧美亚洲另类二区| 久久爱www久久做| 最新中文字幕一区二区三区| 制服.丝袜.亚洲.中文.综合| 国产成人精品免费在线| 亚洲线精品一区二区三区八戒| 欧美一区二区三区视频免费播放| 国产精品18久久久久久vr| 亚洲福利电影网| 欧美激情一区二区三区蜜桃视频 | 蜜桃视频一区二区三区| 中文字幕欧美激情| 日韩一区二区在线观看视频| 不卡视频一二三四| 精品一区二区三区视频| 一区二区三区.www| 久久免费的精品国产v∧| 欧美年轻男男videosbes| 国产91在线观看丝袜| 日本欧美韩国一区三区| 亚洲少妇中出一区| 国产视频视频一区| 91精品麻豆日日躁夜夜躁| 91蜜桃网址入口| 国产成人亚洲精品狼色在线 | 一区二区三区四区国产精品| 26uuu欧美| 欧美福利视频一区| 欧美专区在线观看一区| 成人午夜在线视频| 国产精品一区久久久久| 麻豆精品一二三| 日韩高清在线电影| 午夜久久久影院| 一区二区视频在线| 国产精品卡一卡二| 国产精品每日更新在线播放网址| 欧美精品一区二区三区很污很色的| 欧美乱妇15p| 欧美日韩一区二区在线观看| 色狠狠综合天天综合综合| 99免费精品在线观看| 成人激情免费电影网址| 丰满白嫩尤物一区二区| 成人性生交大片免费看中文网站| 久久成人免费电影| 国内一区二区在线| 黄色日韩三级电影| 国产福利一区在线观看| 国产又黄又大久久| 国产成人一区二区精品非洲| 国产很黄免费观看久久| 丁香婷婷综合色啪| 99国产精品久久久久久久久久久| 色婷婷精品久久二区二区蜜臀av| 色哟哟一区二区在线观看| 91国偷自产一区二区三区观看| 在线免费精品视频| 欧美三级电影网站| 日韩欧美你懂的| ww久久中文字幕| 国产精品国产三级国产aⅴ中文| 亚洲私人黄色宅男| 亚洲国产精品一区二区久久 | 日韩综合小视频| 日本欧美在线观看| 国产美女在线观看一区| 成人激情动漫在线观看| 91福利精品视频| 日韩三级在线免费观看| 久久精品亚洲国产奇米99| 国产精品免费aⅴ片在线观看| 亚洲人被黑人高潮完整版| 亚洲高清免费视频| 韩国精品主播一区二区在线观看| 成年人国产精品| 欧美在线你懂的| 久久久国产精华| 亚洲六月丁香色婷婷综合久久| 五月婷婷另类国产| 国产电影精品久久禁18| 在线观看成人小视频| 日韩一区二区三区高清免费看看| 国产日韩成人精品| 亚洲va韩国va欧美va| 国产精品影视天天线| 色先锋久久av资源部| 日韩视频一区二区三区| 国产精品久久久久久亚洲伦 | 欧美成人精品高清在线播放| 国产蜜臀av在线一区二区三区| 一区二区免费在线| 国产综合色视频| 在线观看视频一区二区欧美日韩| 精品欧美久久久| 亚洲成年人影院| thepron国产精品| 精品美女在线播放| 五月激情综合网| 一本一道波多野结衣一区二区 | 在线播放/欧美激情| 国产精品不卡在线观看| 免费一级片91| 欧美亚洲高清一区| 国产精品看片你懂得| 国产原创一区二区三区| 欧美一区二区三区思思人| 伊人色综合久久天天人手人婷| 成人激情免费网站| 久久久久99精品一区| 欧美aaaaa成人免费观看视频| 日本韩国欧美在线| 一区免费观看视频| 成人午夜视频在线| 久久综合色天天久久综合图片| 日韩精品高清不卡| 欧美日韩一区在线观看| 亚洲九九爱视频| 99精品国产热久久91蜜凸| 国产人妖乱国产精品人妖| 国产老妇另类xxxxx| 日韩精品一区二区三区四区视频 | 欧美aaaaaa午夜精品| 欧美日韩国产一级片| 亚洲一区二区三区四区的 | 国产精品综合av一区二区国产馆| 欧美日韩大陆一区二区| 亚洲午夜久久久久久久久电影院| 99精品国产热久久91蜜凸| 国产精品视频第一区| 成人国产精品免费网站| 亚洲人成7777|