# \#gen\_statem

**URL:** https://erlangforums.com/tag/gen-statem/521.md

[Latest](https://erlangforums.com/latest.md) · [Categories](https://erlangforums.com/categories.md) · [Tags](https://erlangforums.com/tags.md)

---

## [Is it possible to get the remaining time of a gen\_statem state time-out?](https://erlangforums.com/t/is-it-possible-to-get-the-remaining-time-of-a-gen-statem-state-time-out/3722)

<div class="topic-metadata">

**Author:** [@lkuty](https://erlangforums.com/u/lkuty)\
**Replies:** 5\
**Last updated:** [January 7, 2026, 9:41pm UTC](https://erlangforums.com/t/is-it-possible-to-get-the-remaining-time-of-a-gen-statem-state-time-out/3722 "2026-01-07T21:41:10Z")

</div>

Is it possible to get the value (the remaining time) of a gen\_statem state time-out ? Note that I could store the datetime when hitting the state enter call and thus know the time elapsed since it is in the given state.

---

## [How do I make use of gen\_statem(enterstate, L](https://erlangforums.com/t/how-do-i-make-use-of-gen-statem-enterstate-l/5298)

<div class="topic-metadata">

**Author:** [@Paddlaren](https://erlangforums.com/u/Paddlaren)\
**Replies:** 3\
**Last updated:** [December 5, 2025, 7:50am UTC](https://erlangforums.com/t/how-do-i-make-use-of-gen-statem-enterstate-l/5298 "2025-12-05T07:50:55Z")

</div>

Hi, I am building finite state machines and would like to enter a state function directly when transition is made to the state. In the documentation I found: ‘StateName’(enter, OldStateName :: state\_name(), data()) …

---

## [Gen\_statem: looping with {next\_event, internal, \_} blocks calls](https://erlangforums.com/t/gen-statem-looping-with-next-event-internal-blocks-calls/3573)

<div class="topic-metadata">

**Author:** [@rlipscombe](https://erlangforums.com/u/rlipscombe)\
**Replies:** 24\
**Last updated:** [May 8, 2024, 2:55pm UTC](https://erlangforums.com/t/gen-statem-looping-with-next-event-internal-blocks-calls/3573 "2024-05-08T14:55:58Z")

</div>

I have a gen\_statem that needs to loop. I wrote something like the following: init({}) -\> {ok, no\_state, no\_state\_data, \[{next\_event, internal, loop}\]}. handle\_event(internal, loop, \_, \_) -\> timer:sleep(500), …

---

## [When should I ask check\_response to delete request IDs?](https://erlangforums.com/t/when-should-i-ask-check-response-to-delete-request-ids/3575)

<div class="topic-metadata">

**Author:** [@rlipscombe](https://erlangforums.com/u/rlipscombe)\
**Replies:** 3\
**Last updated:** [May 2, 2024, 3:01pm UTC](https://erlangforums.com/t/when-should-i-ask-check-response-to-delete-request-ids/3575 "2024-05-02T15:01:47Z")

</div>

In the documentation for gen\_statem:check\_response/3, it says: Note that deleting an association is not for free and that a collection containing already handled requests can still be used by subsequent calls to check\_…

---

## [Some thoughts on Callbacks](https://erlangforums.com/t/some-thoughts-on-callbacks/1851)

<div class="topic-metadata">

**Author:** [@mmin](https://erlangforums.com/u/mmin)\
**Replies:** 8\
**Last updated:** [September 27, 2022, 7:56am UTC](https://erlangforums.com/t/some-thoughts-on-callbacks/1851 "2022-09-27T07:56:58Z")

</div>

I was thinking about the following thing for some time and I want to hear what other people think of this. While implementing some behavior, we must implement and export callbacks. So, the user interface and the behavio…

---

## [Gen\_statem receiving data](https://erlangforums.com/t/gen-statem-receiving-data/1830)

<div class="topic-metadata">

**Author:** [@Abdelghani](https://erlangforums.com/u/Abdelghani)\
**Replies:** 42\
**Last updated:** [September 13, 2022, 5:27pm UTC](https://erlangforums.com/t/gen-statem-receiving-data/1830 "2022-09-13T17:27:01Z")

</div>

Hello, consider we have a function that communicate with a remote server and returns its data as follows : send\_to\_server(Msg) -\> erlang:send(RemoteRef , Msg), receive Reply -\> Reply end. and we should use it constan…
