Other side has set closing connection after some time of inactivity. It sends FIN, ACK, but my program sent only ACK without FIN as it should based on this Wikipedia post. Basically I have the same problem as in this question.
I don't want solution which tries to send data and check if error occurs I am just curious if it is possible to automatically gracefully close connection also from C# as a reply to FIN, ACK from the other side.
This answer claims that it points to answer, but there is no answer from that person on the pointed page.
EDIT:
Some added information:
I connect as a client through TcpClient class like this:
var client = new TcpClient();
client.Connect(new IPAddress(new byte[] { 192, 168, 1, 112 }), 60000);
Connection is created with RS485/LAN converter. This converter has parameter which defines after how long inactivity it closes connection. This parameter can be set or not. I can't affect that.
Connection (without data, with timeout set to 30 s, client on 192.168.1.13 and converter on 192.168.1.14) looks like this:
11:13:06 192.168.1.13 192.168.1.14 SYN
11:13:06 192.168.1.14 192.168.1.13 SYN, ACK
11:13:06 192.168.1.13 192.168.1.14 ACK
11:13:36 192.168.1.14 192.168.1.13 FIN, ACK
11:13:36 192.168.1.13 192.168.1.14 ACK
As you can see, client doesn't sent FIN and I wait several minutes without communication.