/** Source port number */ public int src_port; /** Destination port number */ public int dst_port; /** Sequence number */ public long sequence; /** ACK number */ public long ack_num; /** URG flag */ public boolean urg; /** ACK flag */ public boolean ack; /** PSH flag */ public boolean psh; /** RST flag */ public boolean rst; /** SYN flag */ public boolean syn; /** FIN flag */ public boolean fin;
InputStream bis = socket.getInputStream();
byte[] lengthBytes = new byte[4];
if (bis.read(lengthBytes, 0, 4) == 4) {
int length = Util.bytesToint(lengthBytes);
int rest = length;
byte[] messageBytes = new byte[length];
int read = 0;
while (rest > 0) {
byte[] buffer = new byte[rest];
read = bis.read(buffer);
if(read > length || rest < 0){
throw new ReadXmlBytesException("读取xml字节流溢出");
}
else {
System.arraycopy(buffer, 0, messageBytes, length - rest, read);
rest -= read;
}
}
return messageBytes;
} else {
throw new ReadXmlBytesException("获取数据长度失败");
}
}
public int src_port;
/** Destination port number */
public int dst_port;
/** Sequence number */
public long sequence;
/** ACK number */
public long ack_num;
/** URG flag */
public boolean urg;
/** ACK flag */
public boolean ack;
/** PSH flag */
public boolean psh;
/** RST flag */
public boolean rst;
/** SYN flag */
public boolean syn;
/** FIN flag */
public boolean fin;