E
ericunfuk
Dear All...............
In the following java imp of stop-and-wait protocol, it creates a
timer, are there any similar functions in C that allows me to do this?
Thanks in advance.
//waiting for the ACK message, stop-and-wait , waiting for 10sec
t = new ACK_timer(10);
while (true)
{
if ( t.timer_out == true )break;
p_rcv = port_default.recv(false);
if ( p_rcv == null ) continue;
len_rcvd = (int)
p_rcv.getPropertyLong("HEADER_CONTENT_LENGTH", l);
message_rcv_id = p_rcv. getPropertyLong ("MESSAGE_ID", k);
//Verify the ACK message
if
( p_rcv.getProperty("HEADER_CONTENT_TYPE","EEE") == "ACK" &&
message_rcv_id == last_send_msg_id )
{
last_ack_msg_id = message_rcv_id ;
t.del_ACK_timer();
break;
}
}
next_send_msg_id = last_ack_msg_id + 1;
} while (true);
}
}
In the following java imp of stop-and-wait protocol, it creates a
timer, are there any similar functions in C that allows me to do this?
Thanks in advance.
//waiting for the ACK message, stop-and-wait , waiting for 10sec
t = new ACK_timer(10);
while (true)
{
if ( t.timer_out == true )break;
p_rcv = port_default.recv(false);
if ( p_rcv == null ) continue;
len_rcvd = (int)
p_rcv.getPropertyLong("HEADER_CONTENT_LENGTH", l);
message_rcv_id = p_rcv. getPropertyLong ("MESSAGE_ID", k);
//Verify the ACK message
if
( p_rcv.getProperty("HEADER_CONTENT_TYPE","EEE") == "ACK" &&
message_rcv_id == last_send_msg_id )
{
last_ack_msg_id = message_rcv_id ;
t.del_ACK_timer();
break;
}
}
next_send_msg_id = last_ack_msg_id + 1;
} while (true);
}
}