Demo entry 2645411

Packet

   

Submitted by anonymous on Sep 08, 2015 at 07:13
Language: Python 3. Code size: 420 Bytes.

class Packet:
    
    data_type = 0
    ack_type = 1
    
    def __init__(self, p_type, seq_no, data_len, data):
        self.magic_no = 0x497E
        
        if p_type == "dataPacket":
            self.p_type = data_type
        elif p_type == "ackknowledgementPacket":
            self.p_type = ack_type
        
        self.seq_no = seq_no
        self.data_len = data_len
        self.data = data

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).