* Checking for closed TCP connection in kernel space
@ 2011-01-04 15:16 Martin Sustrik
0 siblings, 0 replies; only message in thread
From: Martin Sustrik @ 2011-01-04 15:16 UTC (permalink / raw)
To: netdev
Hi all,
I open a TCP socket in the kernel space (sock_create_kern). I connect or
bind it, I send and receive data. Everything works as expected.
The problem is how to find out that the peer have closed the connection.
In user space you get 0 when calling recv() is such case. However, in
kernel space kernel_recvmsg seems to return 0 anytime when there are no
more data available. It doesn't return an error either.
Should I monitor the socket state using sk_state_change callback? But
the callback seems to work in async manner, i.e. I can accidentally use
closed socket before I get notified about the state change.
Any ideas?
Martin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-04 15:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-04 15:16 Checking for closed TCP connection in kernel space Martin Sustrik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).