mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-09-29 04:25:57 -04:00
added function to check whether the socket is still alive
svn path=/icecast/trunk/net/; revision=13582
This commit is contained in:
parent
98546247b1
commit
0bbed6c78d
15
net/sock.c
15
net/sock.c
@ -204,6 +204,21 @@ int sock_valid_socket(sock_t sock)
|
|||||||
return (ret == 0);
|
return (ret == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* determines if the passed socket is still connected */
|
||||||
|
int sock_active (sock_t sock)
|
||||||
|
{
|
||||||
|
char c;
|
||||||
|
int l;
|
||||||
|
|
||||||
|
l = recv (sock, &c, 1, MSG_PEEK);
|
||||||
|
if (l == 0)
|
||||||
|
return 0;
|
||||||
|
if (l < 0 && sock_recoverable (sock_error()))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* inet_aton
|
/* inet_aton
|
||||||
**
|
**
|
||||||
** turns an ascii ip address into a binary representation
|
** turns an ascii ip address into a binary representation
|
||||||
|
@ -105,6 +105,7 @@ int sock_error(void);
|
|||||||
int sock_recoverable(int error);
|
int sock_recoverable(int error);
|
||||||
int sock_stalled(int error);
|
int sock_stalled(int error);
|
||||||
int sock_valid_socket(sock_t sock);
|
int sock_valid_socket(sock_t sock);
|
||||||
|
int sock_active (sock_t sock);
|
||||||
int sock_set_blocking(sock_t sock, const int block);
|
int sock_set_blocking(sock_t sock, const int block);
|
||||||
int sock_set_nolinger(sock_t sock);
|
int sock_set_nolinger(sock_t sock);
|
||||||
int sock_set_keepalive(sock_t sock);
|
int sock_set_keepalive(sock_t sock);
|
||||||
|
Loading…
Reference in New Issue
Block a user