Unrelated TCP closure automatically closes mongoDB's TCP port

I have an application which access MongoDB from the frontend using C# and from the backend using C++.
While running, a couple of TCP ports are established with MongoDB.
The backend also communicates with other devices using TCP.
The issue is when the device closes the port (server side), all MongoDB ports close, loosing the DB connectivity. After this I need to restart the application.
When the device TCP port is normally closed by the client (backend), everything works fine.

Any help with this issue will be much appreciated.

Hi @Jose_Figueiredo welcome to the community!

I’m not sure I understand the architecture yet.

What do you mean exactly by “frontend” and “backend” in this case? Is this a web application, or something else?

What is a device, and what is server side in this context?

In this context, what does client refer to, and why do you call it the backend?

I’m hoping you could provide an example workflow for me to understand the terminology you’re using, and what they are referring to.

Best regards
Kevin

Hi Kevin,

This is a windows application where the frontend is the GUI, which is implemented using C#, and the backend are C++ DLLs.
As I mentioned both access MongoDB, for different purposes, and from what I see, at a certain point there are 3 TCP connections with MongoDB.
When I mention client/server, this refers to TCP. The application communicates with an external device using TCP, and typically the application (TCP client) connects to the device (TCP server) and later disconnects. This is the normal process, and everything works fine.
The issue is when the device (TCP server) disconnects on its own (network issues, device reset, etc). When this happens we verify that this connection is not available anymore and it is reported, but the problem is that all the connections with MongoDB are closed too (by what we see in the MongoDB log), without any apparent reason. To reconnect to the MongoDB we need to restart the application.

Hope this was clearer.
Best regards,
José