当前位置: 首页>>代码示例>>Java>>正文


Java DataMessage.getData方法代码示例

本文整理汇总了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连接已经关闭");
	}

}
 
开发者ID:breakEval13,项目名称:NSS,代码行数:45,代码来源:Sender.java

示例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();
		}
	}
	
}
 
开发者ID:breakEval13,项目名称:NSS,代码行数:47,代码来源:Sender.java

示例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("");
	}
}
 
开发者ID:breakEval13,项目名称:NSS,代码行数:46,代码来源:Receiver.java

示例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("连接已断开");
	}
}
 
开发者ID:jonasxiao,项目名称:FinalSpeed,代码行数:43,代码来源:Receiver.java

示例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");
	}

}
 
开发者ID:RCD-Y,项目名称:FinalSpeed-X,代码行数:45,代码来源:Sender.java

示例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();
		}
	}
	
}
 
开发者ID:RCD-Y,项目名称:FinalSpeed-X,代码行数:45,代码来源: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);
			}
		}

	}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

示例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连接已经关闭");
        }

    }
 
开发者ID:Bpazy,项目名称:finalspeed,代码行数:42,代码来源:Sender.java

示例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();
        }
    }

}
 
开发者ID:Bpazy,项目名称:finalspeed,代码行数:48,代码来源:Sender.java

示例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("连接已断开");
    }
}
 
开发者ID:Bpazy,项目名称:finalspeed,代码行数:42,代码来源:Receiver.java


注:本文中的net.fs.rudp.message.DataMessage.getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。