def send_handshake(self): packet = Datagram() packet.set_head(message_type=2, message_id=1, num_payloads=0, payload_index=0, payload_size=0, error_type=0, restart_index=0) packet.set_EOP() self.transmitter.send(packet.get_datagram())
def send_packet(self, payload, num_payloads, payload_index): packet = Datagram() packet.set_head(message_type=1, message_id=1, num_payloads=num_payloads, payload_index=payload_index, payload_size=len(payload), error_type=0, restart_index=0) packet.set_payload(payload=payload) packet.set_EOP(0) self.transmitter.send(packet.get_datagram())