Skip to main content
Associate II
August 31, 2026
Solved

ST87M01 - DTLS persistent Socket during PSM?

  • August 31, 2026
  • 4 replies
  • 45 views

Hi all, 
for minimum wake time I want to use UDP with DTLS.

However, I wonder if it is OK to keep the Socket open for a longer time (not closing it ever)? Even during PSM?

Opening the DTLS-Sockets costs 2 seconds (handshake) and energy, for a Raw-Socket it is almost zero

DTLS: Init->Wait->Use
[000000]> AT#SOCKETCREATE=5,0,UDP,0,60,60,9,0,0
[000116]< #SOCKETCREATE: 0
[000118]< OK
[000000]> AT#DTLSCONNECT=5,0,xxx.xxx.xxx.xxx,pppp
[002011]< #TLS: 3,0x00A8,2048,0
[002012]< OK
[000000]> AT#IPSENDUDP=5,0,xxx.xxx.xxx.xxx,pppp…


Raw
[000011]< #SOCKETCREATE: 0
[000012]< OK
[000000]> AT#IPSENDUDP=5,0,xxx.xxx.xxx.xxx,pppp…

Thanks for any helpful infos,
Jo

Best answer by Didier HERROUIN

Dear GeoP,

The resumption feature is precisely done for that : you open a socket, you send/receive the data you need, you close it and then, you can re-open the socket faster, using the resumption option. 
Nevertheless, be aware that the session is saved by the server : this one can request a complete handshake whenever it wants, after 1 day or after several sessions resumptions. The node is not the master.

Regards,
Didier

4 replies

Didier HERROUIN
ST Technical Moderator
September 1, 2026

Dear GeoP,

  • While the module is active and not in PSM : you can keep a socket open for a long time if your use case and network timers allow it.
  • Across PSM : sockets are effectively not preserved.  We recommend to re‑open them on each wake‑up, send/receive what you need, then close them before re‑entering PSM.
    You can find a DTLS handshake and session example in the Application Note : “ST87MXX_TLS_Application_Note.pdf” (Note: All the Application Notes are copied on your PC when you install the GUI)

Regards,
Didier

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
GeoPAuthor
Associate II
September 1, 2026

Dear Didier,

thank you very much for the clear explanation and for pointing me to the TLS Application Note.

This confirms that, for our PSM-based ultra-low-power use case, we cannot keep the DTLS socket alive between wake-up cycles. Reopening the socket and performing a DTLS handshake on every wake-up would add considerable latency and energy overhead compared with the single measurement datagram we want to transmit.

Our intended communication pattern is similar to the LoRaWAN philosophy: one uplink packet and, only when required, a maximum of one downlink response per wake-up cycle. We will therefore most likely use raw UDP with authenticated encryption at the application layer for this particular operating mode.

One final question: can the session resumption described in the TLS Application Note still be used after PSM when a new socket is created, or is it only useful while the module remains active?

By the way, the more I work with the ST87M01, the more I like it - it really is a great product! (Although the STMxx GUI stll is not running stable on my PC with latest .NET.. ;.)

Thanks again and best regards,
Jo

Didier HERROUIN
Didier HERROUINBest answer
ST Technical Moderator
September 11, 2026

Dear GeoP,

The resumption feature is precisely done for that : you open a socket, you send/receive the data you need, you close it and then, you can re-open the socket faster, using the resumption option. 
Nevertheless, be aware that the session is saved by the server : this one can request a complete handshake whenever it wants, after 1 day or after several sessions resumptions. The node is not the master.

Regards,
Didier

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
GeoPAuthor
Associate II
September 11, 2026

Hi Didier,

Ah, thanks for the clarification.  

Thanks again and best regards,
Jo