denypacket.java
来自「java语言开发的P2P流媒体系统」· Java 代码 · 共 55 行
JAVA
55 行
/* Stream-2-Stream - Peer to peer television and radio
* Project homepage: http://s2s.sourceforge.net/
* Copyright (C) 2005-2006 Jason Hooks
* ---------------------------------------------------------------------------
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* ---------------------------------------------------------------------------
*/
package p2pradio.packets;
public class DenyPacket extends Packet {
public static final byte OLD_VERSION = 1; //Software is too old
public static final byte IP_INCORRECT = 2; //Bandwidth test IP address is different from the source IP
public static final byte VERIFIED_UPLOAD_BAD = 3; //Verified Upload is greater than the Verified Upload Max
public static final byte VERIFIED_DOWNLOAD_BAD = 4;
public static final byte NOT_ENOUGH_DOWNLOAD = 5;
public static final byte NOT_ENOUGH_UPLOAD = 6;
private byte reason;
public DenyPacket(byte reason)
{
this(Packet.DENY, new byte[getMaxLength()], reason);
}
public DenyPacket(byte packetType, byte content[], byte reason)
{
super(packetType, content);
this.reason = reason;
writeByte(reason);
}
public DenyPacket(byte content[], int contentLength)
{
super(content, contentLength);
reason = readByte();
}
protected static int getMaxLength()
{
return 1 + Packet.getMaxLength();
}
public byte getReason()
{
return reason;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?