1\section{socket\+: General socket manipulations}
2\label{group__socket}\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}}
3\subsection*{IP socket functions}
4\begin{DoxyCompactItemize}
5\item
6int \hyperlink{group__socket_gac3ff4662c65f65784534be54ef73a5c1}{socket\+\_\+tcp4} (void)
7\item
8int \hyperlink{group__socket_gaa40101a7969252728f0f29a7b40afbb0}{socket\+\_\+tcp6} (void)
9\item
10int \hyperlink{group__socket_ga88d576380c2025501e9a8266bcddc759}{socket\+\_\+tcp} (void)
11\item
12int \hyperlink{group__socket_ga6f5bd2aa2b03be301bdd402a96d8c1cc}{socket\+\_\+udp4} (void)
13\item
14int \hyperlink{group__socket_ga97257e7446c72c21b3b80b56efae5114}{socket\+\_\+udp6} (void)
15\item
16int \hyperlink{group__socket_gaaa146f612229109460767f7b33264436}{socket\+\_\+udp} (void)
17\item
18int \hyperlink{group__socket_gad2216a950b5878a7480f2cbba5bb923a}{socket\+\_\+connect4} (int sock, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port)
19\item
20int \hyperlink{group__socket_ga758f2bc0d9366148f783e391b918c6e7}{socket\+\_\+connect4\+\_\+timeout} (int sock, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port, int timeout)
21\item
22int \hyperlink{group__socket_ga748c5c143180e767205d07f047ca679d}{socket\+\_\+connect6} (int sock, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} port)
23\item
24int \hyperlink{group__socket_gad0524d7851f2c470f69560eb84730c5b}{socket\+\_\+connect6\+\_\+timeout} (int sock, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} port, int timeout)
25\item
26int \hyperlink{group__socket_ga456030863437a411c047f2cd2580bdc0}{socket\+\_\+bind4} (int sock, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port)
27\item
28int \hyperlink{group__socket_ga7a5368c8328a7dece54a854fb973f643}{socket\+\_\+bind6} (int sock, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} port)
29\item
30int \hyperlink{group__socket_gac7bc14346128667097799f4754d37929}{socket\+\_\+accept4} (int sock, \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$port)
31\item
32int \hyperlink{group__socket_ga196889012f2f3d11f509233255e2ac99}{socket\+\_\+accept6} (int sock, \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$port)
33\item
34int \hyperlink{group__socket_ga1a5ee61f2d55733cb8fd5b359d10a7a1}{socket\+\_\+recv4} (int sock, char $\ast$buffer, unsigned buflen, \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$port)
35\item
36int \hyperlink{group__socket_gabd201f10a5f8a183a47f4c04094611f2}{socket\+\_\+recv6} (int sock, char $\ast$buffer, unsigned buflen, \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$port)
37\item
38int \hyperlink{group__socket_ga6c2d6ff938d1d397727eed25c7eec506}{socket\+\_\+send4} (int sock, const char $\ast$buffer, unsigned buflen, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port)
39\item
40int \hyperlink{group__socket_ga59f8b78cd870be6e55b0205ce69780b1}{socket\+\_\+send6} (int sock, const char $\ast$buffer, unsigned buflen, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} port)
41\item
42int \hyperlink{group__socket_ga0af45ad3d942c5e666c6c849612b31b9}{socket\+\_\+getaddr4} (int sock, \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$port)
43\item
44int \hyperlink{group__socket_ga369bac4cc0a9f7b0102619c3c51c7b9b}{socket\+\_\+getaddr6} (int sock, \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$port)
45\item
46int \hyperlink{group__socket_ga9b04337ecf3bf5baa28b40452cd21222}{socket\+\_\+cork} (int sock)
47\item
48int \hyperlink{group__socket_gae754518918db3d63dda03d9fd7497f24}{socket\+\_\+uncork} (int sock)
49\item
50int \hyperlink{group__socket_ga3e40999be94c2b893b7b143b6b15e85e}{socket\+\_\+notcpdelay} (int sock, int enable)
51\end{DoxyCompactItemize}
52\subsection*{U\+N\+IX local-\/domain socket functions}
53\begin{DoxyCompactItemize}
54\item
55int \hyperlink{group__socket_ga3c74e521debc5d71da6cb975c24f5a6f}{socket\+\_\+unixdgm} (void)
56\item
57int \hyperlink{group__socket_ga8d8f154af4bc27c718676848aeca4517}{socket\+\_\+unixstr} (void)
58\item
59int \hyperlink{group__socket_gaba7a8b6004c3a3b4ec2760654b932d34}{socket\+\_\+connectu} (int sock, const char $\ast$path)
60\item
61int \hyperlink{group__socket_ga60efe220e9b4f32c40f1f23ee856f9f2}{socket\+\_\+connectu\+\_\+timeout} (int sock, const char $\ast$path, int timeout)
62\item
63int \hyperlink{group__socket_gab8bb1362103f0b7d0b92a26740a25202}{socket\+\_\+bindu} (int sock, const char $\ast$path)
64\item
65int \hyperlink{group__socket_ga47526944d4d396e915254ad74b1718cd}{socket\+\_\+acceptu} (int sock)
66\item
67int \hyperlink{group__socket_ga4a076351ffd2c95067db1d480aad0d74}{socket\+\_\+recvu} (int sock, char $\ast$buffer, unsigned buflen)
68\item
69int \hyperlink{group__socket_ga2e1e867a59f55178bd91943937be27e8}{socket\+\_\+sendu} (int sock, const char $\ast$buffer, unsigned buflen)
70\item
71int \hyperlink{group__socket_ga2ee545eb11adc079c12653558ce1d43a}{socket\+\_\+pairstr} (int fd\mbox{[}2\mbox{]})
72\item
73int \hyperlink{group__socket_ga3518be90b2771241b0dd8330763f524a}{socket\+\_\+pairdgm} (int fd\mbox{[}2\mbox{]})
74\end{DoxyCompactItemize}
75\subsection*{Functions for any type of socket}
76\begin{DoxyCompactItemize}
77\item
78int \hyperlink{group__socket_ga1cd775b2c588a9c1c9f993d760088e4c}{socket\+\_\+broadcast} (int sock)
79\item
80int \hyperlink{group__socket_gabfc66cb9c05f20a016cec536293d391e}{socket\+\_\+connected} (int sock)
81\item
82int \hyperlink{group__socket_ga30b66242db4c2ac40b93f73bbe6d4add}{socket\+\_\+linger} (int fd, int onoff, int seconds)
83\item
84int \hyperlink{group__socket_gadc9f509d40c47189452bbde14b5d4fee}{socket\+\_\+listen} (int sock, int backlog)
85\item
86int \hyperlink{group__socket_ga3836ac2b7108e2f6e203278c846ef56e}{socket\+\_\+reuse} (int sock)
87\item
88int \hyperlink{group__socket_gac91dfda7ec1b043b277fdcd205eb79e8}{socket\+\_\+shutdown} (int sock, int shut\+\_\+rd, int shut\+\_\+wr)
89\item
90int \hyperlink{group__socket_ga0b2ab1619356b51c379c3b3cfd047bf9}{socket\+\_\+sendfd} (int sock, int fd)
91\item
92int \hyperlink{group__socket_ga45a3df16f6b78995662a5a3f485f5edb}{socket\+\_\+recvfd} (int sock)
93\end{DoxyCompactItemize}
94
95
96\subsection{Detailed Description}
97\begin{DoxyParagraph}{Calling Convention}
98
99\end{DoxyParagraph}
100When calling a socket function, the socket file descriptor (where required) will always be the first parameter. Functions that return a file descriptor (either creating a new socket or accepting a connection on a socket return that file descriptor on success or {\ttfamily -\/1} on error. All other functions return non-\/zero (true) on success or {\ttfamily 0} (false) on error. All functions set errno on error.
101
102\subsection{Function Documentation}
103\mbox{\label{group__socket_gac7bc14346128667097799f4754d37929}}
104\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+accept4@{socket\+\_\+accept4}}
105\index{socket\+\_\+accept4@{socket\+\_\+accept4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
106\subsubsection{\texorpdfstring{socket\+\_\+accept4()}{socket\_accept4()}}
107{\footnotesize\ttfamily int socket\+\_\+accept4 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{\hyperlink{structipv4addr}{ipv4addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$}]{port }\end{DoxyParamCaption})}
108
109Accept a connection on a socket from an I\+Pv4 address.
110
111References ipv4addr\+::addr.
112
113\mbox{\label{group__socket_ga196889012f2f3d11f509233255e2ac99}}
114\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+accept6@{socket\+\_\+accept6}}
115\index{socket\+\_\+accept6@{socket\+\_\+accept6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
116\subsubsection{\texorpdfstring{socket\+\_\+accept6()}{socket\_accept6()}}
117{\footnotesize\ttfamily int socket\+\_\+accept6 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{\hyperlink{structipv6addr}{ipv6addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$}]{port }\end{DoxyParamCaption})}
118
119Accept a connection on a socket from an I\+Pv6 address.
120
121References ipv6addr\+::addr.
122
123\mbox{\label{group__socket_ga47526944d4d396e915254ad74b1718cd}}
124\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+acceptu@{socket\+\_\+acceptu}}
125\index{socket\+\_\+acceptu@{socket\+\_\+acceptu}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
126\subsubsection{\texorpdfstring{socket\+\_\+acceptu()}{socket\_acceptu()}}
127{\footnotesize\ttfamily int socket\+\_\+acceptu (\begin{DoxyParamCaption}\item[{int}]{sock }\end{DoxyParamCaption})}
128
129Accept a U\+N\+IX domain connection. \mbox{\label{group__socket_ga456030863437a411c047f2cd2580bdc0}}
130\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+bind4@{socket\+\_\+bind4}}
131\index{socket\+\_\+bind4@{socket\+\_\+bind4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
132\subsubsection{\texorpdfstring{socket\+\_\+bind4()}{socket\_bind4()}}
133{\footnotesize\ttfamily int socket\+\_\+bind4 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const \hyperlink{structipv4addr}{ipv4addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port}}]{port }\end{DoxyParamCaption})}
134
135Bind a socket to an I\+Pv4 address.
136
137References ipv4addr\+::addr.
138
139
140
141Referenced by dns\+\_\+transmit\+\_\+free(), and socket\+\_\+connect4().
142
143\mbox{\label{group__socket_ga7a5368c8328a7dece54a854fb973f643}}
144\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+bind6@{socket\+\_\+bind6}}
145\index{socket\+\_\+bind6@{socket\+\_\+bind6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
146\subsubsection{\texorpdfstring{socket\+\_\+bind6()}{socket\_bind6()}}
147{\footnotesize\ttfamily int socket\+\_\+bind6 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const \hyperlink{structipv6addr}{ipv6addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port}}]{port }\end{DoxyParamCaption})}
148
149Bind a socket to an I\+Pv6 address.
150
151References ipv6addr\+::addr.
152
153\mbox{\label{group__socket_gab8bb1362103f0b7d0b92a26740a25202}}
154\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+bindu@{socket\+\_\+bindu}}
155\index{socket\+\_\+bindu@{socket\+\_\+bindu}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
156\subsubsection{\texorpdfstring{socket\+\_\+bindu()}{socket\_bindu()}}
157{\footnotesize\ttfamily int socket\+\_\+bindu (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const char $\ast$}]{path }\end{DoxyParamCaption})}
158
159Bind a U\+N\+IX domain address (path) to a socket. \mbox{\label{group__socket_ga1cd775b2c588a9c1c9f993d760088e4c}}
160\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+broadcast@{socket\+\_\+broadcast}}
161\index{socket\+\_\+broadcast@{socket\+\_\+broadcast}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
162\subsubsection{\texorpdfstring{socket\+\_\+broadcast()}{socket\_broadcast()}}
163{\footnotesize\ttfamily int socket\+\_\+broadcast (\begin{DoxyParamCaption}\item[{int}]{fd }\end{DoxyParamCaption})}
164
165Mark a socket for broadcast transmission. \mbox{\label{group__socket_gad2216a950b5878a7480f2cbba5bb923a}}
166\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+connect4@{socket\+\_\+connect4}}
167\index{socket\+\_\+connect4@{socket\+\_\+connect4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
168\subsubsection{\texorpdfstring{socket\+\_\+connect4()}{socket\_connect4()}}
169{\footnotesize\ttfamily int socket\+\_\+connect4 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const \hyperlink{structipv4addr}{ipv4addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port}}]{port }\end{DoxyParamCaption})}
170
171Connect a socket to an I\+Pv4 address.
172
173References ipv4addr\+::addr, I\+P\+V4\+A\+D\+D\+R\+\_\+\+A\+NY, I\+P\+V4\+A\+D\+D\+R\+\_\+\+L\+O\+O\+P\+B\+A\+CK, socket\+\_\+bind4(), socket\+\_\+listen(), socket\+\_\+reuse(), and socket\+\_\+tcp4().
174
175
176
177Referenced by dns\+\_\+transmit\+\_\+free(), and socket\+\_\+connect4\+\_\+timeout().
178
179\mbox{\label{group__socket_ga758f2bc0d9366148f783e391b918c6e7}}
180\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+connect4\+\_\+timeout@{socket\+\_\+connect4\+\_\+timeout}}
181\index{socket\+\_\+connect4\+\_\+timeout@{socket\+\_\+connect4\+\_\+timeout}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
182\subsubsection{\texorpdfstring{socket\+\_\+connect4\+\_\+timeout()}{socket\_connect4\_timeout()}}
183{\footnotesize\ttfamily int socket\+\_\+connect4\+\_\+timeout (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const \hyperlink{structipv4addr}{ipv4addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port}}]{port,  }\item[{int}]{timeout }\end{DoxyParamCaption})}
184
185Connect a socket to an I\+Pv4 address, honouring a timeout.
186
187\begin{DoxyNote}{Note}
188The socket will have nonblocking mode turned on on return from this function.
189\end{DoxyNote}
190
191
192References socket\+\_\+connect4(), and socket\+\_\+connected().
193
194\mbox{\label{group__socket_ga748c5c143180e767205d07f047ca679d}}
195\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+connect6@{socket\+\_\+connect6}}
196\index{socket\+\_\+connect6@{socket\+\_\+connect6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
197\subsubsection{\texorpdfstring{socket\+\_\+connect6()}{socket\_connect6()}}
198{\footnotesize\ttfamily int socket\+\_\+connect6 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const \hyperlink{structipv6addr}{ipv6addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port}}]{port }\end{DoxyParamCaption})}
199
200Connect a socket to an I\+Pv6 address.
201
202References ipv6addr\+::addr.
203
204
205
206Referenced by socket\+\_\+connect6\+\_\+timeout().
207
208\mbox{\label{group__socket_gad0524d7851f2c470f69560eb84730c5b}}
209\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+connect6\+\_\+timeout@{socket\+\_\+connect6\+\_\+timeout}}
210\index{socket\+\_\+connect6\+\_\+timeout@{socket\+\_\+connect6\+\_\+timeout}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
211\subsubsection{\texorpdfstring{socket\+\_\+connect6\+\_\+timeout()}{socket\_connect6\_timeout()}}
212{\footnotesize\ttfamily int socket\+\_\+connect6\+\_\+timeout (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const \hyperlink{structipv6addr}{ipv6addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port}}]{port,  }\item[{int}]{timeout }\end{DoxyParamCaption})}
213
214Connect a socket to an I\+Pv6 address, honouring a timeout.
215
216\begin{DoxyNote}{Note}
217The socket will have nonblocking mode turned on on return from this function.
218\end{DoxyNote}
219
220
221References socket\+\_\+connect6(), and socket\+\_\+connected().
222
223\mbox{\label{group__socket_gabfc66cb9c05f20a016cec536293d391e}}
224\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+connected@{socket\+\_\+connected}}
225\index{socket\+\_\+connected@{socket\+\_\+connected}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
226\subsubsection{\texorpdfstring{socket\+\_\+connected()}{socket\_connected()}}
227{\footnotesize\ttfamily int socket\+\_\+connected (\begin{DoxyParamCaption}\item[{int}]{sock }\end{DoxyParamCaption})}
228
229Test if a socket is connected.
230
231Referenced by dns\+\_\+transmit\+\_\+get(), socket\+\_\+connect4\+\_\+timeout(), socket\+\_\+connect6\+\_\+timeout(), and socket\+\_\+connectu\+\_\+timeout().
232
233\mbox{\label{group__socket_gaba7a8b6004c3a3b4ec2760654b932d34}}
234\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+connectu@{socket\+\_\+connectu}}
235\index{socket\+\_\+connectu@{socket\+\_\+connectu}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
236\subsubsection{\texorpdfstring{socket\+\_\+connectu()}{socket\_connectu()}}
237{\footnotesize\ttfamily int socket\+\_\+connectu (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const char $\ast$}]{path }\end{DoxyParamCaption})}
238
239Make an U\+N\+IX domain connection.
240
241Referenced by socket\+\_\+connectu\+\_\+timeout().
242
243\mbox{\label{group__socket_ga60efe220e9b4f32c40f1f23ee856f9f2}}
244\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+connectu\+\_\+timeout@{socket\+\_\+connectu\+\_\+timeout}}
245\index{socket\+\_\+connectu\+\_\+timeout@{socket\+\_\+connectu\+\_\+timeout}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
246\subsubsection{\texorpdfstring{socket\+\_\+connectu\+\_\+timeout()}{socket\_connectu\_timeout()}}
247{\footnotesize\ttfamily int socket\+\_\+connectu\+\_\+timeout (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const char $\ast$}]{path,  }\item[{int}]{timeout }\end{DoxyParamCaption})}
248
249Connect a socket to an U\+N\+IX domain address, honouring a timeout.
250
251\begin{DoxyNote}{Note}
252The socket will have nonblocking mode turned on on return from this function.
253\end{DoxyNote}
254
255
256References socket\+\_\+connected(), and socket\+\_\+connectu().
257
258\mbox{\label{group__socket_ga9b04337ecf3bf5baa28b40452cd21222}}
259\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+cork@{socket\+\_\+cork}}
260\index{socket\+\_\+cork@{socket\+\_\+cork}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
261\subsubsection{\texorpdfstring{socket\+\_\+cork()}{socket\_cork()}}
262{\footnotesize\ttfamily int socket\+\_\+cork (\begin{DoxyParamCaption}\item[{int}]{sock }\end{DoxyParamCaption})}
263
264Stop a T\+CP socket from sending short writes.
265
266Several U\+N\+IX OS\textquotesingle{}s have a facility which can prevent packets from being sent across the wire until they are completely full, even if short writes are sent to the socket that would normally result in output packets. This routine attempts to enable that facility to optimize throughput for bulk data transfers. It is known to work on Linux (with the {\ttfamily T\+C\+P\+\_\+\+C\+O\+RK} option) and to at least compile on B\+SD (with the {\ttfamily T\+C\+P\+\_\+\+N\+O\+P\+U\+SH} option). On OS\textquotesingle{}s which lack either of these two options, this function is essentially a no-\/op. \mbox{\label{group__socket_ga0af45ad3d942c5e666c6c849612b31b9}}
267\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+getaddr4@{socket\+\_\+getaddr4}}
268\index{socket\+\_\+getaddr4@{socket\+\_\+getaddr4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
269\subsubsection{\texorpdfstring{socket\+\_\+getaddr4()}{socket\_getaddr4()}}
270{\footnotesize\ttfamily int socket\+\_\+getaddr4 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{\hyperlink{structipv4addr}{ipv4addr} $\ast$}]{addr,  }\item[{\hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$}]{port }\end{DoxyParamCaption})}
271
272Determine the I\+Pv4 address of a socket.
273
274References ipv4addr\+::addr.
275
276\mbox{\label{group__socket_ga369bac4cc0a9f7b0102619c3c51c7b9b}}
277\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+getaddr6@{socket\+\_\+getaddr6}}
278\index{socket\+\_\+getaddr6@{socket\+\_\+getaddr6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
279\subsubsection{\texorpdfstring{socket\+\_\+getaddr6()}{socket\_getaddr6()}}
280{\footnotesize\ttfamily int socket\+\_\+getaddr6 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{\hyperlink{structipv6addr}{ipv6addr} $\ast$}]{addr,  }\item[{\hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$}]{port }\end{DoxyParamCaption})}
281
282Determine the I\+Pv6 address of a socket.
283
284References ipv6addr\+::addr.
285
286\mbox{\label{group__socket_ga30b66242db4c2ac40b93f73bbe6d4add}}
287\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+linger@{socket\+\_\+linger}}
288\index{socket\+\_\+linger@{socket\+\_\+linger}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
289\subsubsection{\texorpdfstring{socket\+\_\+linger()}{socket\_linger()}}
290{\footnotesize\ttfamily int socket\+\_\+linger (\begin{DoxyParamCaption}\item[{int}]{fd,  }\item[{int}]{onoff,  }\item[{int}]{seconds }\end{DoxyParamCaption})}
291
292Set the socket \char`\"{}linger\char`\"{} option. \mbox{\label{group__socket_gadc9f509d40c47189452bbde14b5d4fee}}
293\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+listen@{socket\+\_\+listen}}
294\index{socket\+\_\+listen@{socket\+\_\+listen}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
295\subsubsection{\texorpdfstring{socket\+\_\+listen()}{socket\_listen()}}
296{\footnotesize\ttfamily int socket\+\_\+listen (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{int}]{backlog }\end{DoxyParamCaption})}
297
298Listen to a socket.
299
300Referenced by socket\+\_\+connect4().
301
302\mbox{\label{group__socket_ga3e40999be94c2b893b7b143b6b15e85e}}
303\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+notcpdelay@{socket\+\_\+notcpdelay}}
304\index{socket\+\_\+notcpdelay@{socket\+\_\+notcpdelay}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
305\subsubsection{\texorpdfstring{socket\+\_\+notcpdelay()}{socket\_notcpdelay()}}
306{\footnotesize\ttfamily int socket\+\_\+notcpdelay (\begin{DoxyParamCaption}\item[{int}]{fd,  }\item[{int}]{on }\end{DoxyParamCaption})}
307
308Turn on or off T\+CP N\+O\+D\+E\+L\+AY flag.
309
310Enabling N\+O\+D\+E\+L\+AY disables the standard Nagle algorithm, which tries to coalesce multiple short writes into one larger packet for better network efficiency. With N\+O\+D\+E\+L\+AY enabled, each write will immediately be sent out onto the network as a seperate packet. \mbox{\label{group__socket_ga3518be90b2771241b0dd8330763f524a}}
311\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+pairdgm@{socket\+\_\+pairdgm}}
312\index{socket\+\_\+pairdgm@{socket\+\_\+pairdgm}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
313\subsubsection{\texorpdfstring{socket\+\_\+pairdgm()}{socket\_pairdgm()}}
314{\footnotesize\ttfamily int socket\+\_\+pairdgm (\begin{DoxyParamCaption}\item[{int}]{fd\mbox{[}2\mbox{]} }\end{DoxyParamCaption})}
315
316Create a pair of datagram sockets. \mbox{\label{group__socket_ga2ee545eb11adc079c12653558ce1d43a}}
317\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+pairstr@{socket\+\_\+pairstr}}
318\index{socket\+\_\+pairstr@{socket\+\_\+pairstr}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
319\subsubsection{\texorpdfstring{socket\+\_\+pairstr()}{socket\_pairstr()}}
320{\footnotesize\ttfamily int socket\+\_\+pairstr (\begin{DoxyParamCaption}\item[{int}]{fd\mbox{[}2\mbox{]} }\end{DoxyParamCaption})}
321
322Create a pair of stream sockets. \mbox{\label{group__socket_ga1a5ee61f2d55733cb8fd5b359d10a7a1}}
323\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+recv4@{socket\+\_\+recv4}}
324\index{socket\+\_\+recv4@{socket\+\_\+recv4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
325\subsubsection{\texorpdfstring{socket\+\_\+recv4()}{socket\_recv4()}}
326{\footnotesize\ttfamily int socket\+\_\+recv4 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{char $\ast$}]{buffer,  }\item[{unsigned}]{buflen,  }\item[{\hyperlink{structipv4addr}{ipv4addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$}]{port }\end{DoxyParamCaption})}
327
328Receive a datagram from a U\+DP socket.
329
330References ipv4addr\+::addr.
331
332\mbox{\label{group__socket_gabd201f10a5f8a183a47f4c04094611f2}}
333\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+recv6@{socket\+\_\+recv6}}
334\index{socket\+\_\+recv6@{socket\+\_\+recv6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
335\subsubsection{\texorpdfstring{socket\+\_\+recv6()}{socket\_recv6()}}
336{\footnotesize\ttfamily int socket\+\_\+recv6 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{char $\ast$}]{buffer,  }\item[{unsigned}]{buflen,  }\item[{\hyperlink{structipv6addr}{ipv6addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$}]{port }\end{DoxyParamCaption})}
337
338Receive a datagram from an I\+Pv6 U\+DP socket.
339
340References ipv6addr\+::addr.
341
342\mbox{\label{group__socket_ga45a3df16f6b78995662a5a3f485f5edb}}
343\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+recvfd@{socket\+\_\+recvfd}}
344\index{socket\+\_\+recvfd@{socket\+\_\+recvfd}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
345\subsubsection{\texorpdfstring{socket\+\_\+recvfd()}{socket\_recvfd()}}
346{\footnotesize\ttfamily int socket\+\_\+recvfd (\begin{DoxyParamCaption}\item[{int}]{sock }\end{DoxyParamCaption})}
347
348Receive a file descriptor over a socket. \mbox{\label{group__socket_ga4a076351ffd2c95067db1d480aad0d74}}
349\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+recvu@{socket\+\_\+recvu}}
350\index{socket\+\_\+recvu@{socket\+\_\+recvu}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
351\subsubsection{\texorpdfstring{socket\+\_\+recvu()}{socket\_recvu()}}
352{\footnotesize\ttfamily int socket\+\_\+recvu (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{char $\ast$}]{buffer,  }\item[{unsigned}]{buflen }\end{DoxyParamCaption})}
353
354Receive a datagram from a U\+N\+IX domain socket. \mbox{\label{group__socket_ga3836ac2b7108e2f6e203278c846ef56e}}
355\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+reuse@{socket\+\_\+reuse}}
356\index{socket\+\_\+reuse@{socket\+\_\+reuse}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
357\subsubsection{\texorpdfstring{socket\+\_\+reuse()}{socket\_reuse()}}
358{\footnotesize\ttfamily int socket\+\_\+reuse (\begin{DoxyParamCaption}\item[{int}]{fd }\end{DoxyParamCaption})}
359
360Mark a socket for address reuse.
361
362Referenced by socket\+\_\+connect4().
363
364\mbox{\label{group__socket_ga6c2d6ff938d1d397727eed25c7eec506}}
365\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+send4@{socket\+\_\+send4}}
366\index{socket\+\_\+send4@{socket\+\_\+send4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
367\subsubsection{\texorpdfstring{socket\+\_\+send4()}{socket\_send4()}}
368{\footnotesize\ttfamily int socket\+\_\+send4 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const char $\ast$}]{buffer,  }\item[{unsigned}]{buflen,  }\item[{const \hyperlink{structipv4addr}{ipv4addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv4_ga113bbf93f3b0011263ce519bb1ca7481}{ipv4port}}]{port }\end{DoxyParamCaption})}
369
370Send a datagram on a U\+DP socket.
371
372References ipv4addr\+::addr.
373
374\mbox{\label{group__socket_ga59f8b78cd870be6e55b0205ce69780b1}}
375\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+send6@{socket\+\_\+send6}}
376\index{socket\+\_\+send6@{socket\+\_\+send6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
377\subsubsection{\texorpdfstring{socket\+\_\+send6()}{socket\_send6()}}
378{\footnotesize\ttfamily int socket\+\_\+send6 (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const char $\ast$}]{buffer,  }\item[{unsigned}]{buflen,  }\item[{const \hyperlink{structipv6addr}{ipv6addr} $\ast$}]{ip,  }\item[{\hyperlink{group__ipv6_gaa71ffb8f46cd4fa830090d23eb752847}{ipv6port}}]{port }\end{DoxyParamCaption})}
379
380Send a datagram on an I\+Pv6 U\+DP socket.
381
382References ipv6addr\+::addr.
383
384\mbox{\label{group__socket_ga0b2ab1619356b51c379c3b3cfd047bf9}}
385\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+sendfd@{socket\+\_\+sendfd}}
386\index{socket\+\_\+sendfd@{socket\+\_\+sendfd}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
387\subsubsection{\texorpdfstring{socket\+\_\+sendfd()}{socket\_sendfd()}}
388{\footnotesize\ttfamily int socket\+\_\+sendfd (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{int}]{fd }\end{DoxyParamCaption})}
389
390Send a file descriptor over a socket. \mbox{\label{group__socket_ga2e1e867a59f55178bd91943937be27e8}}
391\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+sendu@{socket\+\_\+sendu}}
392\index{socket\+\_\+sendu@{socket\+\_\+sendu}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
393\subsubsection{\texorpdfstring{socket\+\_\+sendu()}{socket\_sendu()}}
394{\footnotesize\ttfamily int socket\+\_\+sendu (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{const char $\ast$}]{buffer,  }\item[{unsigned}]{buflen }\end{DoxyParamCaption})}
395
396Send a datagram on a U\+N\+IX domain socket. \mbox{\label{group__socket_gac91dfda7ec1b043b277fdcd205eb79e8}}
397\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+shutdown@{socket\+\_\+shutdown}}
398\index{socket\+\_\+shutdown@{socket\+\_\+shutdown}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
399\subsubsection{\texorpdfstring{socket\+\_\+shutdown()}{socket\_shutdown()}}
400{\footnotesize\ttfamily int socket\+\_\+shutdown (\begin{DoxyParamCaption}\item[{int}]{sock,  }\item[{int}]{shut\+\_\+rd,  }\item[{int}]{shut\+\_\+wr }\end{DoxyParamCaption})}
401
402Shut down part or all of a socket. \mbox{\label{group__socket_ga88d576380c2025501e9a8266bcddc759}}
403\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+tcp@{socket\+\_\+tcp}}
404\index{socket\+\_\+tcp@{socket\+\_\+tcp}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
405\subsubsection{\texorpdfstring{socket\+\_\+tcp()}{socket\_tcp()}}
406{\footnotesize\ttfamily int socket\+\_\+tcp (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
407
408Create a T\+C\+P/\+IP socket.
409
410References socket\+\_\+tcp4().
411
412
413
414Referenced by dns\+\_\+transmit\+\_\+free().
415
416\mbox{\label{group__socket_gac3ff4662c65f65784534be54ef73a5c1}}
417\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+tcp4@{socket\+\_\+tcp4}}
418\index{socket\+\_\+tcp4@{socket\+\_\+tcp4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
419\subsubsection{\texorpdfstring{socket\+\_\+tcp4()}{socket\_tcp4()}}
420{\footnotesize\ttfamily int socket\+\_\+tcp4 (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
421
422Create a T\+C\+P/\+I\+Pv4 socket.
423
424Referenced by socket\+\_\+connect4(), and socket\+\_\+tcp().
425
426\mbox{\label{group__socket_gaa40101a7969252728f0f29a7b40afbb0}}
427\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+tcp6@{socket\+\_\+tcp6}}
428\index{socket\+\_\+tcp6@{socket\+\_\+tcp6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
429\subsubsection{\texorpdfstring{socket\+\_\+tcp6()}{socket\_tcp6()}}
430{\footnotesize\ttfamily int socket\+\_\+tcp6 (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
431
432Create a T\+C\+P/\+I\+Pv6 socket. \mbox{\label{group__socket_gaaa146f612229109460767f7b33264436}}
433\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+udp@{socket\+\_\+udp}}
434\index{socket\+\_\+udp@{socket\+\_\+udp}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
435\subsubsection{\texorpdfstring{socket\+\_\+udp()}{socket\_udp()}}
436{\footnotesize\ttfamily int socket\+\_\+udp (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
437
438Create a U\+D\+P/\+IP socket.
439
440References socket\+\_\+udp4().
441
442
443
444Referenced by dns\+\_\+transmit\+\_\+free().
445
446\mbox{\label{group__socket_ga6f5bd2aa2b03be301bdd402a96d8c1cc}}
447\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+udp4@{socket\+\_\+udp4}}
448\index{socket\+\_\+udp4@{socket\+\_\+udp4}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
449\subsubsection{\texorpdfstring{socket\+\_\+udp4()}{socket\_udp4()}}
450{\footnotesize\ttfamily int socket\+\_\+udp4 (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
451
452Create a U\+D\+P/\+I\+Pv4 socket.
453
454Referenced by socket\+\_\+udp().
455
456\mbox{\label{group__socket_ga97257e7446c72c21b3b80b56efae5114}}
457\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+udp6@{socket\+\_\+udp6}}
458\index{socket\+\_\+udp6@{socket\+\_\+udp6}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
459\subsubsection{\texorpdfstring{socket\+\_\+udp6()}{socket\_udp6()}}
460{\footnotesize\ttfamily int socket\+\_\+udp6 (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
461
462Create a U\+D\+P/\+I\+Pv6 socket. \mbox{\label{group__socket_gae754518918db3d63dda03d9fd7497f24}}
463\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+uncork@{socket\+\_\+uncork}}
464\index{socket\+\_\+uncork@{socket\+\_\+uncork}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
465\subsubsection{\texorpdfstring{socket\+\_\+uncork()}{socket\_uncork()}}
466{\footnotesize\ttfamily int socket\+\_\+uncork (\begin{DoxyParamCaption}\item[{int}]{sock }\end{DoxyParamCaption})}
467
468Unstop a T\+CP socket from sending short writes. \mbox{\label{group__socket_ga3c74e521debc5d71da6cb975c24f5a6f}}
469\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+unixdgm@{socket\+\_\+unixdgm}}
470\index{socket\+\_\+unixdgm@{socket\+\_\+unixdgm}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
471\subsubsection{\texorpdfstring{socket\+\_\+unixdgm()}{socket\_unixdgm()}}
472{\footnotesize\ttfamily int socket\+\_\+unixdgm (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
473
474Create U\+N\+IX domain datagram socket. \mbox{\label{group__socket_ga8d8f154af4bc27c718676848aeca4517}}
475\index{socket\+: General socket manipulations@{socket\+: General socket manipulations}!socket\+\_\+unixstr@{socket\+\_\+unixstr}}
476\index{socket\+\_\+unixstr@{socket\+\_\+unixstr}!socket\+: General socket manipulations@{socket\+: General socket manipulations}}
477\subsubsection{\texorpdfstring{socket\+\_\+unixstr()}{socket\_unixstr()}}
478{\footnotesize\ttfamily int socket\+\_\+unixstr (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}
479
480Create U\+N\+IX domain stream socket.