Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
620c51f6
Commit
620c51f6
authored
Aug 21, 2007
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added function to check whether the socket is still alive
svn path=/icecast/trunk/net/; revision=13582
parent
bd266785
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
src/net/sock.c
src/net/sock.c
+15
-0
src/net/sock.h
src/net/sock.h
+1
-0
No files found.
src/net/sock.c
View file @
620c51f6
...
...
@@ -204,6 +204,21 @@ int sock_valid_socket(sock_t sock)
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
**
** turns an ascii ip address into a binary representation
...
...
src/net/sock.h
View file @
620c51f6
...
...
@@ -105,6 +105,7 @@ int sock_error(void);
int
sock_recoverable
(
int
error
);
int
sock_stalled
(
int
error
);
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_nolinger
(
sock_t
sock
);
int
sock_set_keepalive
(
sock_t
sock
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment