Exemple #1
0
    def __init__(self,
                 transport,
                 source_address,
                 source_port,
                 destination_address,
                 destination_port,
                 app=None,
                 window=1000):
        Connection.__init__(self, transport, source_address, source_port,
                            destination_address, destination_port, app)

        ### Sender functionality
        self.totalQueueingDelay = 0.0
        self.totalPacketsSent = 0
        self.output = False
        self.dynamic = True
        self.proveTimer = False
        # send window; represents the total number of bytes that may
        # be outstanding at one time
        # Step 2
        self.window = window
        # send buffer
        self.send_buffer = SendBuffer()
        # maximum segment size, in bytes
        # self.mss = 1000
        self.mss = min(1000, window)
        # largest sequence number that has been ACKed so far; represents
        # the next sequence number the client expects to receive
        self.sequence = 0
        # retransmission timer
        self.timer = None
        # timeout duration in seconds
        self.timeout = 1.0
        if self.dynamic:
            self.timeout = 3.0
        # estimated rtt
        self.est_rtt = None
        # alpha
        self.alpha = 0.125
        # variation rtt
        self.var_rtt = None  ## TODO: revisit this later
        # beta
        self.beta = 0.25
        ### Receiver functionality

        # receive buffer
        self.receive_buffer = ReceiveBuffer()
        # ack number to send; represents the largest in-order sequence
        # number not yet received
        self.ack = 0
Exemple #2
0
    def __init__(self,transport,source_address,source_port,
                 destination_address,destination_port,app=None,window=1000):
        Connection.__init__(self,transport,source_address,source_port,
                            destination_address,destination_port,app)

        ### Sender functionality
        self.totalQueueingDelay = 0.0
        self.totalPacketsSent = 0
        self.port = source_port
        self.dynamic = True
        self.output = False
        self.proveTimer = False
        self.proveCong = False
        self.stand_trace = False
        self.seq_plot = False
        self.graph1 = True
        self.graph2 = False   # == This is controlled in the transfer file by Sim.set_debug('Link')
        self.graph3 = False
        self.graph4 = False

        if self.graph2:
            Sim.set_debug('Link')
        # send window; represents the total number of bytes that may
        # be outstanding at one time
        # maximum segment size, in bytes
        self.mss = 1000
        # Step 2
        self.window = self.mss  ######################### This one gets the mess adjusted out of it
        # threshold for slow start
        self.thresh = 100000
        self.inc_sum = 0
        # for fast retransmit
        self.last_ack = 0
        self.dup_counter = 0
        self.drop_next = False
        self.has_dropped = False
        self.dropped_count = 0
        # send buffer
        self.send_buffer = SendBuffer()
        ############################################# (this never gets adjusted)
        #self.mss = min(1000, window) ################ TODO: handle the case where window is bigger than mss
        # largest sequence number that has been ACKed so far; represents
        # the next sequence number the client expects to receive
        self.sequence = 0
        # retransmission timer
        self.timer = None
        # timeout duration in seconds
        self.timeout = 1.0
        if self.dynamic:
            self.timeout = 3.0
        # estimated rtt
        self.est_rtt = None
        # alpha
        self.alpha = 0.125
        # variation rtt
        self.var_rtt = None  ## TODO: revisit this later
        # beta
        self.beta = 0.25
        ### Receiver functionality

        # receive buffer
        self.receive_buffer = ReceiveBuffer()
        # ack number to send; represents the largest in-order sequence
        # number not yet received
        self.ack = 0