From 95e3e26d1297bdd9640ea491ef55ae371790794e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 13 Feb 2023 21:47:22 -0600 Subject: [PATCH] Send TCP FIN after completion of our RTSP request This allows servers to read until a FIN, just like we do on the client. --- src/PlatformSockets.h | 2 ++ src/RtspConnection.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/PlatformSockets.h b/src/PlatformSockets.h index 97c5ad6..26f1ceb 100644 --- a/src/PlatformSockets.h +++ b/src/PlatformSockets.h @@ -15,6 +15,8 @@ #define SetLastSocketError(x) WSASetLastError(x) #define LastSocketError() WSAGetLastError() +#define SHUT_RD SD_RECEIVE +#define SHUT_WR SD_SEND #define SHUT_RDWR SD_BOTH #ifdef EAGAIN diff --git a/src/RtspConnection.c b/src/RtspConnection.c index 65fca43..aadf2f3 100644 --- a/src/RtspConnection.c +++ b/src/RtspConnection.c @@ -267,6 +267,9 @@ static bool transactRtspMessageTcp(PRTSP_MESSAGE request, PRTSP_MESSAGE response goto Exit; } + // Notify the server that we're finished sending the request with a FIN + shutdown(sock, SHUT_WR); + // Read the response until the server closes the connection offset = 0; responseBufferSize = 0;