How to set the timer in the Go Back N protocol? - TCP-IP

This is a discussion on How to set the timer in the Go Back N protocol? - TCP-IP ; I want to implement the Go Back N protocol in C language. There is only one timer for all the packets to be sent to check the timeout event. How can I use this timer? For example. there are 5 ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: How to set the timer in the Go Back N protocol?

  1. How to set the timer in the Go Back N protocol?

    I want to implement the Go Back N protocol in C language. There is
    only one timer for all the packets to be sent to check the timeout
    event.
    How can I use this timer?
    For example. there are 5 packets, A, B, C, D, E,
    I set the timer for A when A is sent. Then the packet B is sent and so
    on.
    But when the A is lost, the time out event for the packet A is occur.
    I must reset the timer for the packet A.
    Then can I set the timer for the packet B?


  2. Re: How to set the timer in the Go Back N protocol?

    In article <1180366811.854344.92010@i13g2000prf.googlegroups.c om>,
    Thinking writes:
    > I want to implement the Go Back N protocol in C language. There is
    > only one timer for all the packets to be sent to check the timeout
    > event.
    > How can I use this timer?
    > For example. there are 5 packets, A, B, C, D, E,
    > I set the timer for A when A is sent. Then the packet B is sent and so
    > on.
    > But when the A is lost, the time out event for the packet A is occur.
    > I must reset the timer for the packet A.
    > Then can I set the timer for the packet B?
    >


    Are you sure this is not homework?

    Anyway, the timer is for the lowest _unacknowledged_ packet, which is
    originally packet A. Two things can happen:

    1) The timer triggers.
    Retransmit A (and perhaps B-E also, but this depends on the details
    of the protocol) and rearm the timer.

    2) A is acknowledged. Now B becomes the lowest unacknowledged packet.
    Rearm the timer and retransmit B when the timer triggers.

  3. Re: How to set the timer in the Go Back N protocol?

    On 5月29日, 上午11时42分, f...@securityaudit.val.newsbank.net (Dick
    Wesseling) wrote:
    > In article <1180366811.854344.92...@i13g2000prf.googlegroups.c om>,
    > Thinking writes:
    >
    > > I want to implement theGoBackNprotocol in C language. There is
    > > only one timer for all the packets to be sent to check the timeout
    > > event.
    > > How can I use this timer?
    > > For example. there are 5 packets, A, B, C, D, E,
    > > I set the timer for A when A is sent. Then the packet B is sent and so
    > > on.
    > > But when the A is lost, the time out event for the packet A is occur.
    > > I must reset the timer for the packet A.
    > > Then can I set the timer for the packet B?

    >
    > Are you sure this is not homework?

    This is my homework.
    >
    > Anyway, the timer is for the lowest _unacknowledged_ packet, which is
    > originally packet A. Two things can happen:
    >
    > 1) The timer triggers.
    > Retransmit A (and perhaps B-E also, but this depends on the details
    > of the protocol) and rearm the timer.

    The question is how to rearm the timer?
    I think the timer should be set as soon as the packet was sent.
    For example, when the timer triggers, retransmitting A. When the ACK
    for A is recieved, how to rearm the timer for packet B? Because I
    don't know the sending time for B. So how to decide the time to wait
    for B? When the timer for B should trigger?
    >
    > 2) A is acknowledged. Now B becomes the lowest unacknowledged packet.
    > Rearm the timer and retransmit B when the timer triggers.

    Now how to rearm the timer? Just resetup the timer like A? I don't
    know how long I should wait for the packet B.



  4. Re: How to set the timer in the Go Back N protocol?

    In article <1180429407.845427.229050@j4g2000prf.googlegroups.c om>,
    Thinking wrote:
    >On 5月29日, 上午11时42分, f...@securityaudit.val.newsbank.net (Dick
    >Wesseling) wrote:
    >> In article <1180366811.854344.92...@i13g2000prf.googlegroups.c om>,
    >> Thinking writes:
    >>
    >> > I want to implement theGoBackNprotocol in C language. There is
    >> > only one timer for all the packets to be sent to check the timeout
    >> > event.
    >> > How can I use this timer?


    >Now how to rearm the timer? Just resetup the timer like A? I don't
    >know how long I should wait for the packet B.


    The C language does not provide any timers. All timers are
    system-specific extensions. Therefore, the mechanisms needed to
    rearm the timer are system specific, and you will need to ask
    about the technical details in a newsgroup that deals with the
    specific operating system you are using.

  5. Re: How to set the timer in the Go Back N protocol?

    On 5月29日, 下午10时23分, rober...@hushmail.com (Walter Roberson) wrote:
    > In article <1180429407.845427.229...@j4g2000prf.googlegroups.c om>,
    >
    > Thinking wrote:
    > >On 5 29 , 11 ±42· , f...@securityaudit.val.newsbank.net (Dick
    > >Wesseling) wrote:
    > >> In article <1180366811.854344.92...@i13g2000prf.googlegroups.c om>,
    > >> Thinking writes:

    >
    > >> > I want to implement theGoBackNprotocol in C language. There is
    > >> > only one timer for all the packets to be sent to check the timeout
    > >> > event.
    > >> > How can I use this timer?

    > >Now how to rearm the timer? Just resetup the timer like A? I don't
    > >know how long I should wait for the packet B.

    >
    > The C language does not provide any timers. All timers are
    > system-specific extensions. Therefore, the mechanisms needed to
    > rearm the timer are system specific, and you will need to ask
    > about the technical details in a newsgroup that deals with the
    > specific operating system you are using.

    Thank you very much for your answer.
    My question is how to set the timer if we have a function whose task
    is to implement a timer. So suppose we have the timer function, then
    how to set or rearm the timer for packet B?
    Because the timer is start when packet A is sent or resent, when we
    receive the ack for packet A, how can we set the timer properly for
    packet B? Suppose the timer timer of packet B is the same as packet
    A,. What is the *start time* for the packet B timer?


  6. Re: How to set the timer in the Go Back N protocol?

    On May 29, 7:55 am, Thinking wrote:

    > Thank you very much for your answer.
    > My question is how to set the timer if we have a function whose task
    > is to implement a timer. So suppose we have the timer function, then
    > how to set or rearm the timer for packet B?
    > Because the timer is start when packet A is sent or resent, when we
    > receive the ack for packet A, how can we set the timer properly for
    > packet B? Suppose the timer timer of packet B is the same as packet
    > A,. What is the *start time* for the packet B timer?


    We have no idea what kind of timers you are talking about. We also
    have no idea what kind of packets you are talking about. Are you
    implementing TCP? Are you implementing reliable delivery on top of
    UDP? Or are you dealing with a protocol layered on top of TCP and just
    want to detect a dead link?

    The simplest answer to your question is just to leave the timer for B
    alone. When you send A, set a timer for it. When you send B, set a
    timer for it. When A is acknowledged, cancel the timer for A and leave
    the timer for B alone.

    DS


  7. Re: How to set the timer in the Go Back N protocol?

    On 5月30日, 上午2时28分, David Schwartz wrote:
    > On May 29, 7:55 am, Thinking wrote:
    >
    > > Thank you very much for your answer.
    > > My question is how to set the timer if we have a function whose task
    > > is to implement a timer. So suppose we have the timer function, then
    > > how to set or rearm the timer for packet B?
    > > Because the timer is start when packet A is sent or resent, when we
    > > receive the ack for packet A, how can we set the timer properly for
    > > packet B? Suppose the timer timer of packet B is the same as packet
    > > A,. What is the *start time* for the packet B timer?

    >
    > We have no idea what kind of timers you are talking about. We also
    > have no idea what kind of packets you are talking about. Are you
    > implementing TCP? Are you implementing reliable delivery on top of
    > UDP? Or are you dealing with a protocol layered on top of TCP and just
    > want to detect a dead link?
    >
    > The simplest answer to your question is just to leave the timer for B
    > alone. When you send A, set a timer for it. When you send B, set a
    > timer for it. When A is acknowledged, cancel the timer for A and leave
    > the timer for B alone.
    >
    > DS


    I want to implement a simulator for the go back n protocol. The only
    task I should do is to implement the go back n protocol. I can't find
    a way to implement this protocol using only one timer. Certainly, this
    protocol can be used in TCP to make sure that the transport is
    reliable.


  8. Re: How to set the timer in the Go Back N protocol?

    In article <1180481467.268914.105260@x35g2000prf.googlegroups. com>,
    Thinking writes:
    >
    > I want to implement a simulator for the go back n protocol. The only
    > task I should do is to implement the go back n protocol. I can't find
    > a way to implement this protocol using only one timer. Certainly, this
    > protocol can be used in TCP to make sure that the transport is
    > reliable.
    >


    TCP uses one timer. This is a good thing because TCP is byte oriented,
    not packet oriented like a data link protocol. Keeping a seperate
    timer for each byte transmitted would be impractical.

    That being said, let's pretend TCP is packet (in TCP talk "segment")
    oriented for the sake of the explanation:

    TCP sends segments/packets A B C D E
    A gets lost and a timeout occurs. The sender has no idea what happened
    to BCDE. The sender resends A and it deflates its congestion window. As
    a result it does not have to worry about timers for BCDE, these cannot
    be resend anyway before the congestion window grows again.
    Next the ack for the (re)tranmission of A arrives. If B was also received
    then this will be a cumulative ack for A+B. Otherwise the sender
    retransmits B and C and sets a timer for B because B is now the lowest
    unacknowledged segment.

    Keep in mind that "Go Back N" is not a protocol, but a class of
    protocols. The details for the retransmission strategy depend on the
    actual protocol. For example, TCP must deal with congestion but a
    data link protocol does not have to worry about this. A data link
    protocol might therefore choose to retransmit ABCDE when a timeout
    occurs. This also applies to timeouts: the details depend on the
    actual protocol.
    If your assignment only said that you must implement some sort of
    Go Back N without further requirements then you're free to use your
    imagination.
    Ask yourself:
    - Does the receiver buffer BCDE when A gets lost?
    - What are the chances of both A and B getting lost?
    - What happens when the timeout value is too small?

  9. Re: How to set the timer in the Go Back N protocol?

    On 5 30 , 12 30 , f...@securityaudit.val.newsbank.net (Dick
    Wesseling) wrote:
    > In article <1180481467.268914.105...@x35g2000prf.googlegroups. com>,
    > Thinking writes:
    >
    >
    >
    > > I want to implement a simulator for the go back n protocol. The only
    > > task I should do is to implement the go back n protocol. I can't find
    > > a way to implement this protocol using only one timer. Certainly, this
    > > protocol can be used in TCP to make sure that the transport is
    > > reliable.

    >
    > TCP uses one timer. This is a good thing because TCP is byte oriented,
    > not packet oriented like a data link protocol. Keeping a seperate
    > timer for each byte transmitted would be impractical.
    >
    > That being said, let's pretend TCP is packet (in TCP talk "segment")
    > oriented for the sake of the explanation:
    >
    > TCP sends segments/packets A B C D E
    > A gets lost and a timeout occurs. The sender has no idea what happened
    > to BCDE. The sender resends A and it deflates its congestion window. As
    > a result it does not have to worry about timers for BCDE, these cannot
    > be resend anyway before the congestion window grows again.
    > Next the ack for the (re)tranmission of A arrives. If B was also received
    > then this will be a cumulative ack for A+B. Otherwise the sender
    > retransmits B and C and sets a timer for B because B is now the lowest
    > unacknowledged segment.
    >
    > Keep in mind that "Go Back N" is not a protocol, but a class of
    > protocols. The details for the retransmission strategy depend on the
    > actual protocol. For example, TCP must deal with congestion but a
    > data link protocol does not have to worry about this. A data link
    > protocol might therefore choose to retransmit ABCDE when a timeout
    > occurs. This also applies to timeouts: the details depend on the
    > actual protocol.
    > If your assignment only said that you must implement some sort of
    > Go Back N without further requirements then you're free to use your
    > imagination.
    > Ask yourself:
    > - Does the receiver buffer BCDE when A gets lost?
    > - What are the chances of both A and B getting lost?
    > - What happens when the timeout value is too small?


    Thank you very much for your detailed explanation.


+ Reply to Thread