Examples of ReliableProtocolMessage


Examples of programming5.net.ReliableProtocolMessage

        while (!done) {
            try {
                message = client.receive(timeout);
                if (message != null) {
                    try {
                        receivedMsg = new ReliableProtocolMessage(message.getBytes());
                        if (receivedMsg.isAcknowledge() && receivedMsg.getSequence() == enforcedMsg.getSequence()) {
                            done = true;
                        }
                    }
                    catch (MalformedMessageException mme) {
View Full Code Here

Examples of programming5.net.ReliableProtocolMessage

     */
    @Override
    public void signalEvent(MessageArrivedEvent protocolEvent) {
        if (protocolEvent != null) {
            try {
                ReliableProtocolMessage rcvdMsg = new ReliableProtocolMessage(protocolEvent.getContentBytes());
                if (rcvdMsg.isAcknowledge()) {
                    Debug.println("RUDP Ack received for " + rcvdMsg.getSequence() + " at " + rcvdMsg.getIndex(), "programming5.net.sockets.ReliableUDPClient");
                    synchronized (messageTable) {
                        ReliableProtocolMessage[] sentSequence = messageTable.get(rcvdMsg.getSequence());
                        if (sentSequence != null) {
                            sentSequence[rcvdMsg.getIndex()-1].signalAcked();
                        }
                    }
                }
                else {
                    long sequence = rcvdMsg.getSequence();
                    ReliableProtocolMessage ack = new ReliableProtocolMessage(sequence, rcvdMsg.getIndex());
                    try {
                        client.replyTo(protocolEvent, ack.getMessageBytes());
                    }
                    catch (NetworkException ne) {
                        Debug.printStackTrace(ne);
                    }
                    String streamID = ((AsynchMessageArrivedEvent) protocolEvent).getSourceURL() + "/" + Long.toString(rcvdMsg.getSequence());
View Full Code Here

Examples of programming5.net.ReliableProtocolMessage

            while (collision != null) {
                sendSequence = random.nextLong();
                collision = messageTable.get(sendSequence);
            }
            for (int i = 0; i < packetization.length; i++) {
                ret[i] = new ReliableProtocolMessage(packetization[i], sendSequence, (i+1), packetization.length, destURL);
            }
            messageTable.put(sendSequence, ret);
        }
        return ret;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.