Arm Mbed OS support forum

How to handle -0x7880 correctly?


I have a working mbedtls FTPS client implementation. However, as soon as the file transfer over the data connection finished, the server (vsftpd) terminates the data connection and the client prints MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY (-0x7880) errors:

tls                 : error  : [2021/09/15 18:26:32.820] [id =      6]: ../../src/../externals/mbedtls/mbedtls/library/ssl_tls.c(4369): mbedtls_ssl_handle_message_t
ype() returned -30848 (-0x7880)

tls                 : error  : [2021/09/15 18:26:32.820] [id =      7]: ../../src/../externals/mbedtls/mbedtls/library/ssl_tls.c(8335): mbedtls_ssl_read_record() returned -30848

The file transfer however finished correctly and the data was written to a file as expected. How should this be handled correctly so that these messages do not appear? Why are they marked “error”?
I think the server terminating the connection after successful data transmission is correct behavior, is it not?

Double posted on tls1.2 - How to handle -0x7880 correctly in mbedtls client? - Stack Overflow and will make sure to keep replies in sync between the two threads!