📄 global.java
字号:
package naplet.nsocket;
import java.util.*;
import java.math.BigInteger;
/**
* This class contains some of constants used in this package
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author Xiliang Zhong
* @version 1.0
*/
public class Global
{
/** states of current NSocket */
public static final int SUSPENDED_LOCAL = 0;
public static final int SUSPENDED_REMOTE = 0;
public static final int RESUMED = 2;
public static final int CLOSED = 3;
/** the peer is suspending */
public static final int SUSPEND_ACKWAIT = 4;
public static final int SUSPEND_SENT = 5;
public static final int SUSPEND_ACK_SEND = 6;
public static final int SUSPEND_ACK_RCD = 7;
public static final int HALF_RESUMED = 8;
public static final int SUSPENDED = 0;
/** Type of current socket */
public static final int TRANSIENT = 0;
public static final int PERSISTENT = 1;
public static final int BUFFER_SIZE = 2048000;
public static final String ACKMSG = "AckMsg:";
public static final String ACK_WAIT_MSG = "AckWaitMsg:";
public static final String ACK_STOP_RESUME = "AckStopResume";
public static final int HIGH_PRIORITY = 1;
public static final int LOW_PRIORITY = 2;
/** port used by socket server of the control channel. can be changed
* by socket controller */
// public static int CONTROL_PORT = 5001;
/** port used by some test application */
public static int TCPPORT = 3868;
/** port used by UDP server, if only one server, then use the port; if more
* than one, the next one will use UDPPORT+1,the next UDPPORT+2, and so on*/
// public static final int UDPPORT = 8683;
/** time out value for UDP in mili seconds*/
public static final int UDPTIMEOUT = 4000;
public static final int UDPRETRY = 3;
/** length of message send between client and server, for both tcp and udp*/
public static final int MESSLEN = 256;
/** Message displayed when nothing found*/
public static final String NOTFOUND = "not found";
/** query by author name*/
public static final int AUTHOR = 1;
/** query by book name*/
public static final int NAME = 2;
/** query by book number*/
public static final int NUMBER = 3;
/** unkown query */
public static final int UNKNOWN = -1;
/** use for Diffie-Hellman key exchange, */
public static final BigInteger N = new BigInteger( "999" );
public static final BigInteger G = new BigInteger( "2" );
public static final int KEYSIZE = 8;
/**
* Generate a socket ID for NapletSocket
* @return
*/
public static String generateID()
{
return String.valueOf( System.currentTimeMillis() ) + "-" +
String.valueOf( random.nextInt() ) + "-" + String.valueOf( counter++ );
}
/**
* seed used by the ID generator
*/
private static Random random = new Random();
/**
* counter used by the ID generator
*/
private static int counter = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -