本文整理汇总了Java中net.fs.rudp.message.DataMessage.getData方法的典型用法代码示例。如果您正苦于以下问题:Java DataMessage.getData方法的具体用法?Java DataMessage.getData怎么用?Java DataMessage.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.fs.rudp.message.DataMessage
的用法示例。
在下文中一共展示了DataMessage.getData方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendNata
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
void sendNata(byte[] data,int offset,int length) throws ConnectException, InterruptedException{
if(!closed){
if(!streamClosed){
DataMessage me=new DataMessage(sequence,data,0,(short) length,conn.connectId,conn.route.localclientId);
me.setDstAddress(dstIp);
me.setDstPort(dstPort);
synchronized (syn_send_table) {
sendTable.put(me.getSequence(),me);
}
synchronized (winOb){
if(!conn.receiver.checkWin()){
try {
winOb.wait();
} catch (InterruptedException e) {
throw e;
}
}
}
boolean twice=false;
if(RUDPConfig.twice_tcp){
twice=true;
}
if(RUDPConfig.double_send_start){
if(me.getSequence()<=5){
twice=true;
}
}
sendDataMessage(me,false,twice,true);
lastSendTime=System.currentTimeMillis();
sendOffset++;
s+=me.getData().length;
conn.clientControl.resendMange.addTask(conn, sequence);
sequence++;//必须放最后
}else{
throw new ConnectException("RDP连接已断开sendData");
}
}else{
throw new ConnectException("RDP连接已经关闭");
}
}
示例2: sendDataMessage
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
void sendDataMessage(DataMessage me,boolean resend,boolean twice,boolean block){
synchronized (conn.clientControl.getSynlock()) {
long startTime=System.nanoTime();
long t1=System.currentTimeMillis();
conn.clientControl.onSendDataPacket(conn);
int timeId=conn.clientControl.getCurrentTimeId();
me.create(timeId);
SendRecord record_current=conn.clientControl.getSendRecord(timeId);
if(!resend){
//第一次发,修改当前时间记录
me.setFirstSendTimeId(timeId);
me.setFirstSendTime(System.currentTimeMillis());
record_current.addSended_First(me.getData().length);
record_current.addSended(me.getData().length);
}else {
//重发,修改第一次发送时间记录
SendRecord record=conn.clientControl.getSendRecord(me.getFirstSendTimeId());
record.addResended(me.getData().length);
record_current.addSended(me.getData().length);
}
try {
sendSum++;
sum++;
unAckMax++;
long t=System.currentTimeMillis();
send(me.getDatagramPacket());
if(twice){
send(me.getDatagramPacket());//发两次
}
if(block){
conn.clientControl.sendSleep(startTime, me.getData().length);
}
TrafficEvent event=new TrafficEvent("",ran.nextLong(),me.getData().length,TrafficEvent.type_uploadTraffic);
Route.fireEvent(event);
} catch (IOException e) {
e.printStackTrace();
}
}
}
示例3: receive
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
public byte[] receive() throws ConnectException {
DataMessage me=null;
if(conn.isConnected()){
me=receiveTable.get(lastRead+1);
synchronized (availOb){
if(me==null){
//MLog.println("等待中 "+conn.connectId+" "+(lastRead+1));
try {
availOb.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
me=receiveTable.get(lastRead+1);
//MLog.println("等待完成aaa "+conn.connectId+" "+(lastRead+1));
}
}
}else{
//throw new ConnectException("连接未建立");
throw new ConnectException("");
}
if(!streamClose){
checkCloseOffset_Remote();
if(me==null){
//throw new ConnectException("连接已断开");
throw new ConnectException("");
}else {
}
conn.sender.sendLastReadDelay();
lastRead++;
synchronized (availOb){
receiveTable.remove(me.getSequence());
}
received+=me.getData().length;
//System.out.println("received "+received/1024/1024+"MB");
return me.getData();
}else{
//throw new ConnectException("连接已断开");
throw new ConnectException("");
}
}
示例4: receive
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
public byte[] receive() throws ConnectException {
DataMessage me=null;
if(conn.isConnected()){
me=receiveTable.get(lastRead+1);
synchronized (availOb){
if(me==null){
//MLog.println("等待中 "+conn.connectId+" "+(lastRead+1));
try {
availOb.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
me=receiveTable.get(lastRead+1);
//MLog.println("等待完成aaa "+conn.connectId+" "+(lastRead+1));
}
}
}else{
throw new ConnectException("连接未建立");
}
if(!streamClose){
checkCloseOffset_Remote();
if(me==null){
throw new ConnectException("连接已断开ccccccc");
}else {
}
conn.sender.sendLastReadDelay();
lastRead++;
synchronized (availOb){
receiveTable.remove(me.getSequence());
}
received+=me.getData().length;
//System.out.println("received "+received/1024/1024+"MB");
return me.getData();
}else{
throw new ConnectException("连接已断开");
}
}
示例5: sendNata
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
void sendNata(byte[] data,int offset,int length) throws ConnectException, InterruptedException{
if(!closed){
if(!streamClosed){
DataMessage me=new DataMessage(sequence,data,0,(short) length,conn.connectId,conn.route.localclientId);
me.setDstAddress(dstIp);
me.setDstPort(dstPort);
synchronized (syn_send_table) {
sendTable.put(me.getSequence(),me);
}
synchronized (winOb){
if(!conn.receiver.checkWin()){
try {
winOb.wait();
} catch (InterruptedException e) {
throw e;
}
}
}
boolean twice=false;
if(RUDPConfig.twice_tcp){
twice=true;
}
if(RUDPConfig.double_send_start){
if(me.getSequence()<=5){
twice=true;
}
}
sendDataMessage(me,false,twice,true);
lastSendTime=System.currentTimeMillis();
sendOffset++;
s+=me.getData().length;
conn.clientControl.resendMange.addTask(conn, sequence);
sequence++;//必须放最后
}else{
throw new ConnectException("RDP connction broken sendData");
}
}else{
throw new ConnectException("RDP connection closed");
}
}
示例6: sendDataMessage
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
void sendDataMessage(DataMessage me,boolean resend,boolean twice,boolean block){
synchronized (conn.clientControl.getSynlock()) {
long startTime=System.nanoTime();
conn.clientControl.onSendDataPacket(conn);
int timeId=conn.clientControl.getCurrentTimeId();
me.create(timeId);
SendRecord record_current=conn.clientControl.getSendRecord(timeId);
if(!resend){
//第一次发,修改当前时间记录
me.setFirstSendTimeId(timeId);
me.setFirstSendTime(System.currentTimeMillis());
record_current.addSended_First(me.getData().length);
record_current.addSended(me.getData().length);
}else {
//重发,修改第一次发送时间记录
SendRecord record=conn.clientControl.getSendRecord(me.getFirstSendTimeId());
record.addResended(me.getData().length);
record_current.addSended(me.getData().length);
}
try {
sendSum++;
sum++;
unAckMax++;
send(me.getDatagramPacket());
if(twice){
send(me.getDatagramPacket());//发两次
}
if(block){
conn.clientControl.sendSleep(startTime, me.getData().length);
}
TrafficEvent event=new TrafficEvent("",ran.nextLong(),me.getData().length,TrafficEvent.type_uploadTraffic);
Route.fireEvent(event);
} catch (IOException e) {
e.printStackTrace();
}
}
}
示例7: receive
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
public byte[] receive() throws ConnectException {
DataMessage me=null;
if(conn.isConnected()){
me=receiveTable.get(lastRead+1);
synchronized (availOb){
if(me==null){
//MLog.println("等待中 "+conn.connectId+" "+(lastRead+1));
try {
availOb.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
me=receiveTable.get(lastRead+1);
}
}
}else{
throw new ConnectException("Connection not established");
}
if(!streamClose){
checkCloseOffset_Remote();
if(me==null){
throw new ConnectException("Connection broken");
}else {
}
conn.sender.sendLastReadDelay();
lastRead++;
synchronized (availOb){
receiveTable.remove(me.getSequence());
}
received+=me.getData().length;
//System.out.println("received "+received/1024/1024+"MB");
return me.getData();
}else{
throw new ConnectException("Connection broken");
}
}
示例8: sendNata
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
void sendNata(byte[] data, int offset, int length) throws ConnectException, InterruptedException {
if (!closed) {
if (!streamClosed) {
DataMessage me = new DataMessage(sequence, data, 0, (short) length, conn.connectId, conn.route
.localclientId);
me.setDstAddress(dstIp);
me.setDstPort(dstPort);
synchronized (syn_send_table) {
sendTable.put(me.getSequence(), me);
}
synchronized (winOb) {
if (!conn.receiver.checkWin()) {
winOb.wait();
}
}
boolean twice = false;
if (RUDPConfig.twice_tcp) {
twice = true;
}
if (RUDPConfig.double_send_start) {
if (me.getSequence() <= 5) {
twice = true;
}
}
sendDataMessage(me, false, twice, true);
lastSendTime = System.currentTimeMillis();
sendOffset++;
s += me.getData().length;
conn.clientControl.resendMange.addTask(conn, sequence);
sequence++;//必须放最后
} else {
throw new ConnectException("RDP连接已断开sendData");
}
} else {
throw new ConnectException("RDP连接已经关闭");
}
}
示例9: sendDataMessage
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
void sendDataMessage(DataMessage me, boolean resend, boolean twice, boolean block) {
synchronized (conn.clientControl.getSynlock()) {
long startTime = System.nanoTime();
long t1 = System.currentTimeMillis();
conn.clientControl.onSendDataPacket(conn);
int timeId = conn.clientControl.getCurrentTimeId();
me.create(timeId);
SendRecord record_current = conn.clientControl.getSendRecord(timeId);
if (!resend) {
//第一次发,修改当前时间记录
me.setFirstSendTimeId(timeId);
me.setFirstSendTime(System.currentTimeMillis());
record_current.addSended_First(me.getData().length);
record_current.addSended(me.getData().length);
} else {
//重发,修改第一次发送时间记录
SendRecord record = conn.clientControl.getSendRecord(me.getFirstSendTimeId());
record.addResended(me.getData().length);
record_current.addSended(me.getData().length);
}
try {
sendSum++;
sum++;
unAckMax++;
long t = System.currentTimeMillis();
send(me.getDatagramPacket());
if (twice) {
send(me.getDatagramPacket());//发两次
}
if (block) {
conn.clientControl.sendSleep(startTime, me.getData().length);
}
TrafficEvent event = new TrafficEvent("", ran.nextLong(), me.getData().length, TrafficEvent
.type_uploadTraffic);
Route.fireEvent(event);
} catch (IOException e) {
e.printStackTrace();
}
}
}
示例10: receive
import net.fs.rudp.message.DataMessage; //导入方法依赖的package包/类
public byte[] receive() throws ConnectException {
DataMessage me;
if (conn.isConnected()) {
me = receiveTable.get(lastRead + 1);
synchronized (availOb) {
if (me == null) {
//MLog.println("等待中 "+conn.connectId+" "+(lastRead+1));
try {
availOb.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
me = receiveTable.get(lastRead + 1);
//MLog.println("等待完成aaa "+conn.connectId+" "+(lastRead+1));
}
}
} else {
throw new ConnectException("连接未建立");
}
if (!streamClose) {
checkCloseOffset_Remote();
if (me == null) {
throw new ConnectException("连接已断开ccccccc");
}
conn.sender.sendLastReadDelay();
lastRead++;
synchronized (availOb) {
receiveTable.remove(me.getSequence());
}
received += me.getData().length;
//System.out.println("received "+received/1024/1024+"MB");
return me.getData();
} else {
throw new ConnectException("连接已断开");
}
}