Mihaly Zachar wrote:
> C-ben keszul egy szerver progi, ami TCP-n beszelget a kliensekkel...
>
> a kerdes roviden annyi, hogy lehet eszrevenni, ha a kliens kilep ?
>
> ilyenkor az a socketem CLOSE_WAIT allapotba kerul, es vegtelensegig
> (legalabbis nagyon sok ideig) fogja a file descriptort, ami hosszutavon
> nem egeszseges...
>
> hogy lehet ezt az allapotot felderiteni, hogy be tudjam zarni azt a file
> descriptort ?
>
read man^H^H^H^H^H^H^H^Hman read ;)
NAME
read - read from a file descriptor
SYNOPSIS
#include <unistd.h>
ssize_t read(int fd, void *buf, size_t count);
[...]
RETURN VALUE
On success, the number of bytes read is returned (zero indicates
end of
file), and the file position is advanced by this number.
vagyis elnagyolva:
n = read(socket_fd, buf, BUFSIZE);
if(!n) close(socket_fd);
--
cc
_________________________________________________
linux lista - [email protected]
http://mlf2.linux.rulez.org/mailman/listinfo/linux