projects
/
gapil.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Tre righe su ''quickack''.
[gapil.git]
/
listati
/
is_closing.c
1
int is_closing(int sock)
2
{
3
int err;
4
struct tcp_info info;
5
socklen_t len = sizeof(info);
6
if (getsockopt(sock, SOL_TCP, TCP_INFO, &info, &len) != -1) {
7
if (info.tcpi_state == TCP_CLOSE ||
8
info.tcpi_state == TCP_CLOSE_WAIT ||
9
info.tcpi_state == TCP_CLOSING) {
10
return 1;
11
} else {
12
return 0;
13
}
14
} else {
15
return errno;
16
}
17
}