A
A
Andrew2011-11-11 19:17:26
C++ / C#
Andrew, 2011-11-11 19:17:26

Epoll ESTABLISHED connections on the server?

Hello!
www.opennet.ru/base/dev/epoll_intro.txt.html
I collected this example - server and client (tester.cpp) - everything works, but
if you turn off the Internet on the client machine (where tester.cpp is), then all connections
hang on the server :
TCP
0 0 213.239.219.253:4444 213.142.143.187:55305 Established TCP
0 0 213.239.219.253.1444 213.142.143.187:55304 Established TCP 0 0 213.239.219.253.187:553.142.143.187:55307 Established TCP
0 0 213.239.219.253: 4444 the ESTABLISHED 213.142.143.187:55306
the tcp 0 0 213.142.143.187:55301 the ESTABLISHED 213.239.219.253:4444 the
tcp 0 0 213.142.143.187:55300 the ESTABLISHED 213.239.219.253:4444 the
tcp 0 0 213.142.143.187:55303 the ESTABLISHED 213.239.219.253:4444
... .
….
What are the algorithms for closing such connections?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mejedi, 2011-11-17
@mejedi

From the server's point of view, such connections are no different from "normal" ones. Any connection starts in the ESTABLISHED state (we ignore previous states that relate to establishing a connection). The connection state on the server changes either when some packets come from the network, or when the server does something with the socket. In this case, nothing comes from the client machine, so the state does not change. If the server tries to write something to such a connection, after the set timeout has passed, the connection will be closed with the error no route to host.
The client can establish a connection and leave it "hanging" indefinitely, it will look the same. This is solved by introducing a timeout, after which the connection is closed if there is no activity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question