⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pingevent.java

📁 Java p2p程序设计2002年版
💻 JAVA
字号:
package net.jxta.impl.shell.bin.ping;import java.util.*;/** * Provided to PingReplyListeners when a ping reply is received by * a PingReplyHandler. This represents the initial ping leg and not * the reply. * * This event object holds two timestamps. One representing the sending * time and one representing the receving time. Plus the differential * time. * */public class PingEvent extends java.util.EventObject {        //timestamp of ping arrival    long timestamp = 0;        // name of peer who sent this message    String name = "";        // timestamp when ping left    long ostamp = 0;        /** Creates new PingEvent */    public PingEvent(Object source, String name, long ot, long t) {        super(source);        this.name = name;        this.ostamp = ot;        this.timestamp = t;    }        /**     * @return This method returns the timestamp of the origin of the ping     * message, which is to say, the ping sender.     */    public long getOriginTimestamp() {        return ostamp;    }        /**     * @return Returns the timestamp when the ping message was received.     */    public long getTimestamp() {        return timestamp;    }    /**     * @return The name of the peer who sent the ping message     */    public String getPeerName() {        return name;    }        /**     * @return Returns the time differential between the sender     * and receiver of this leg of a ping.     */    public long getDifferential() {        return timestamp-ostamp;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -