O
omkar.tilak
I am writing a java program which receives messages (over TCP socket)
from other java program. However, program need to do different
activities depending upon the message received. Program has a variable
called as prog_state. When prog starts, it is initialized to 'Start'.
Now in 'Start' state, if program receives message m1, it should change
its state to 'A' (i.e. merely assign value 'A' to prog_state'
variable). In the same start state, it it receives message m2, it
should change state to 'B'. However, if prog remains in 'Start' state
for more than certain time (say 5 seconds), it should automativally
change its state to 'C'. This is similar to FSM specification but it
has a time transition. I am having trouble in simulating the time
behavior (automatically transit after certain time period while still
being in a position to accept message during that period). Any
suggestions / code snippets in this regard will be of great help.
Thanks and regards
---OMKAR
from other java program. However, program need to do different
activities depending upon the message received. Program has a variable
called as prog_state. When prog starts, it is initialized to 'Start'.
Now in 'Start' state, if program receives message m1, it should change
its state to 'A' (i.e. merely assign value 'A' to prog_state'
variable). In the same start state, it it receives message m2, it
should change state to 'B'. However, if prog remains in 'Start' state
for more than certain time (say 5 seconds), it should automativally
change its state to 'C'. This is similar to FSM specification but it
has a time transition. I am having trouble in simulating the time
behavior (automatically transit after certain time period while still
being in a position to accept message during that period). Any
suggestions / code snippets in this regard will be of great help.
Thanks and regards
---OMKAR