listen_8c.tex
2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
\hypertarget{listen_8c}{
\section{src/socket/listen.c File Reference}
\label{listen_8c}\index{src/socket/listen.c@{src/socket/listen.c}}
}
{\ttfamily \#include $<$stdlib.h$>$}\par
{\ttfamily \#include $<$errno.h$>$}\par
{\ttfamily \#include \char`\"{}socket.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}interface/class.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}interface/logger.h\char`\"{}}\par
Include dependency graph for listen.c:
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
void \hyperlink{listen_8c_a757c220e9371523ef55b1137a1efed57}{socketListen} (\hyperlink{structSock}{Sock} this, int backlog)
\end{DoxyCompactItemize}
\subsection{Function Documentation}
\hypertarget{listen_8c_a757c220e9371523ef55b1137a1efed57}{
\index{listen.c@{listen.c}!socketListen@{socketListen}}
\index{socketListen@{socketListen}!listen.c@{listen.c}}
\subsubsection[{socketListen}]{\setlength{\rightskip}{0pt plus 5cm}void socketListen (
\begin{DoxyParamCaption}
\item[{{\bf Sock}}]{this, }
\item[{int}]{backlog}
\end{DoxyParamCaption}
)}}
\label{listen_8c_a757c220e9371523ef55b1137a1efed57}
Definition at line 10 of file listen.c.
\begin{DoxyCode}
{
(this->addr).sin_family = AF_INET; /* Internet address family
*/
(this->addr).sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface *
/
(this->addr).sin_port = htons(this->port); /* Local port */
/* Bind to the local address */
if (-1 == bind(this->handle, (struct sockaddr *) &(this->addr), sizeof(this->
addr))) {
loggerLog(this->log, LOGGER_CRIT,
"error binding socket: %s - service terminated",
strerror(errno));
exit(EXIT_FAILURE);
}
/* Mark the socket so it will listen for incoming connections */
if (-1 == listen(this->handle, backlog)) {
loggerLog(this->log, LOGGER_CRIT,
"error binding socket: %s - service terminated",
strerror(errno));
exit(EXIT_FAILURE);
}
}
\end{DoxyCode}
Here is the call graph for this function: