diff --git a/core/net/ip/tcp-socket.c b/core/net/ip/tcp-socket.c index d697ccdd9..cd26634a1 100644 --- a/core/net/ip/tcp-socket.c +++ b/core/net/ip/tcp-socket.c @@ -399,3 +399,9 @@ tcp_socket_max_sendlen(struct tcp_socket *s) return s->output_data_maxlen - s->output_data_len; } /*---------------------------------------------------------------------------*/ +int +tcp_socket_queuelen(struct tcp_socket *s) +{ + return s->output_data_len; +} +/*---------------------------------------------------------------------------*/ diff --git a/core/net/ip/tcp-socket.h b/core/net/ip/tcp-socket.h index 34cb0d6b7..dd7b5c793 100644 --- a/core/net/ip/tcp-socket.h +++ b/core/net/ip/tcp-socket.h @@ -284,4 +284,16 @@ int tcp_socket_unregister(struct tcp_socket *s); */ int tcp_socket_max_sendlen(struct tcp_socket *s); +/** + * \brief The number of bytes waiting to be sent + * \param s A pointer to a TCP socket + * \return The number of bytes that have not yet been acknowledged by the receiver. + * + * This function queries the TCP socket and returns the + * number of bytes that are currently not yet known to + * have been successfully received by the receiver. + * + */ +int tcp_socket_queuelen(struct tcp_socket *s); + #endif /* TCP_SOCKET_H */