RTC Forums
July 21, 2024, 04:52:08 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
   Home   Help Login Register  
Pages: [1]
Author Topic: TCP port connections in CLOSE_WAIT state  (Read 3370 times)
RTC License+
Posts: 17

« on: February 11, 2021, 04:05:10 PM »


I have an RTC server with a browser front end. What happens to the server thread when a browser makes a request to the server and the browser is closed before the server response is received back?

I did a netstat -ano  on the server port and showed a lot of open TCP port connections that are in a CLOSE_WAIT state.

What does this mean?

D.Tkalcec (RTC)
Posts: 1881

« Reply #1 on: February 11, 2021, 04:18:11 PM »

If you are using the TRtcHttpServer component on Windows and with its default non-blocking setting ("Blocking" property is set to FALSE), then the component will be using a Thread ONLY when data is actively being sent, received or processed. If no data is being sent, received or processed (which normally only happens in "user" code), then no Threads would be used, regardless of the state of a TCP/IP connection.

Connections which are in some semi-closed state, or connections which are open but are NOT actively used (no data is being sent, received or processed) would still use some System resources like a Socket Handle and some RAM (Objects holding connection info), but they won't be using any Threads (no CPU drain) ... provided your Server is running on Windows and the "Blocking" property on the "TRtcHttpServer" component is set to FALSE.

Connections which have been closed by one side but not the other (CLOSE_WAIT and TIME_WAIT state) would normally be closed by the Socket API after a time-out, which could be anywhere between a few minutes and a couple of hours, depending on your OS preferences.

Best Regards,
Danijel Tkalcec
Pages: [1]
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.022 seconds with 17 queries.