本文整理汇总了Java中net.fs.rudp.message.DataMessage类的典型用法代码示例。如果您正苦于以下问题:Java DataMessage类的具体用法?Java DataMessage怎么用?Java DataMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataMessage类属于net.fs.rudp.message包,在下文中一共展示了DataMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reSend
import net.fs.rudp.message.DataMessage; //导入依赖的package包/类
public void reSend(int sequence,int count){
if(sendTable.containsKey(sequence)){
DataMessage dm=sendTable.get(sequence);
if(dm!=null){
sendDataMessage(dm,true,false,true);
}
}
}
开发者ID:breakEval13,项目名称:NSS,代码行数:9,代码来源:Sender.java
示例2: reSend
import net.fs.rudp.message.DataMessage; //导入依赖的package包/类
public void reSend(int sequence, int count) {
if (sendTable.containsKey(sequence)) {
DataMessage dm = sendTable.get(sequence);
if (dm != null) {
sendDataMessage(dm, true, false, true);
}
}
}
开发者ID:Bpazy,项目名称:finalspeed,代码行数:9,代码来源:Sender.java
示例3: 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连接已经关闭");
}
}
开发者ID:breakEval13,项目名称:NSS,代码行数:45,代码来源:Sender.java
示例4: 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();
}
}
}
开发者ID:breakEval13,项目名称:NSS,代码行数:47,代码来源:Sender.java
示例5: getDataMessage
import net.fs.rudp.message.DataMessage; //导入依赖的package包/类
DataMessage getDataMessage(int sequence){
return sendTable.get(sequence);
}
开发者ID:breakEval13,项目名称:NSS,代码行数:4,代码来源:Sender.java
示例6: removeSended_Ack
import net.fs.rudp.message.DataMessage; //导入依赖的package包/类
void removeSended_Ack(int sequence){
synchronized (syn_send_table) {
DataMessage dm=sendTable.remove(sequence);
}
}
开发者ID:breakEval13,项目名称:NSS,代码行数:6,代码来源:Sender.java
示例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);
//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("");
}
}
开发者ID:breakEval13,项目名称:NSS,代码行数:46,代码来源:Receiver.java
示例8: 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("连接已断开");
}
}
开发者ID:jonasxiao,项目名称:FinalSpeed,代码行数:43,代码来源:Receiver.java
示例9: 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");
}
}
开发者ID:RCD-Y,项目名称:FinalSpeed-X,代码行数:45,代码来源:Sender.java
示例10: 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();
}
}
}
开发者ID:RCD-Y,项目名称:FinalSpeed-X,代码行数:45,代码来源:Sender.java
示例11: 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");
}
}
开发者ID:RCD-Y,项目名称:FinalSpeed-X,代码行数:42,代码来源:Receiver.java
示例12: 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连接已经关闭");
}
}
开发者ID:Bpazy,项目名称:finalspeed,代码行数:42,代码来源:Sender.java
示例13: 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();
}
}
}
开发者ID:Bpazy,项目名称:finalspeed,代码行数:48,代码来源:Sender.java
示例14: getDataMessage
import net.fs.rudp.message.DataMessage; //导入依赖的package包/类
DataMessage getDataMessage(int sequence) {
return sendTable.get(sequence);
}
开发者ID:Bpazy,项目名称:finalspeed,代码行数:4,代码来源:Sender.java
示例15: 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("连接已断开");
}
}
开发者ID:Bpazy,项目名称:finalspeed,代码行数:42,代码来源:Receiver.java
注:本文中的net.fs.rudp.message.DataMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论