<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size:12pt">Hi,</span>
<div style="font-size:12pt"><br>
</div>
<div style="font-size:12pt">It is possible to configure (and build) otp *without* socket (esock) support.</div>
<div style="font-size:12pt">That is what the ifdef'ing is about. Eventually, when socket is properly</div>
<div style="font-size:12pt">official, this will be removed.</div>
<div style="font-size:12pt"><br>
</div>
<div style="font-size:12pt">Regards,</div>
<div style="font-size:12pt"> /BMK</div>
<span style="font-size:12pt"></span><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> erlang-questions <erlang-questions-bounces@erlang.org> on behalf of Nalin Ranjan <ranjanified@gmail.com><br>
<b>Sent:</b> Tuesday, January 26, 2021 1:12 PM<br>
<b>To:</b> Erlang-Questions Questions <erlang-questions@erlang.org><br>
<b>Subject:</b> Type Specification of net:getnameinfo()</font>
<div> </div>
</div>
<div>
<div dir="ltr"><a href="https://erlang.org/doc/man/net.html#getnameinfo-2">Type</a> of net:getnameinfo() is specified in the
<a href="https://protect2.fireeye.com/v1/url?k=b7971346-e80c2a40-b79753dd-86ee86bd5107-36a745eb8cb7a80a&q=1&e=300a3de5-54c4-41b9-bbee-604bb9991333&u=https%3A%2F%2Fgithub.com%2Ferlang%2Fotp%2Fblob%2Fmaster%2Flib%2Fkernel%2Fsrc%2Fnet.erl%23L203">
source file</a>, and the one prevailing in the docs is as below:-
<div><br>
</div>
<div>
<table class="x_gmail-highlight x_gmail-tab-size x_gmail-js-file-line-container" style="border-spacing:0px; border-collapse:collapse; color:rgb(216,212,207); font-size:14px; background-color:rgb(19,21,22)">
<tbody style="box-sizing:border-box">
<tr style="box-sizing:border-box; background-color:transparent">
<td id="x_gmail-LC220" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">-</span><span class="x_gmail-pl-c1" style="box-sizing:border-box; color:rgb(110,192,255)">spec</span>
<span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
getnameinfo</span>(<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">SockAddr</span>,
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">
Flags</span>) <span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
-></span> {<span class="x_gmail-pl-c1" style="box-sizing:border-box; color:rgb(110,192,255)">ok</span>,
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">
Info</span>} | {<span class="x_gmail-pl-c1" style="box-sizing:border-box; color:rgb(110,192,255)">error</span>,
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">
Reason</span>} <span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
when</span></td>
</tr>
<tr style="box-sizing:border-box">
<td id="x_gmail-L221" class="x_gmail-blob-num x_gmail-js-line-number" style="box-sizing:border-box; padding:0px 10px; width:50px; min-width:50px; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; line-height:20px; color:rgba(211,207,201,0.3); text-align:right; white-space:nowrap; vertical-align:top; border-right:0px">
</td>
<td id="x_gmail-LC221" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">SockAddr</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
term</span>(),</td>
</tr>
<tr style="box-sizing:border-box; background-color:transparent">
<td id="x_gmail-L222" class="x_gmail-blob-num x_gmail-js-line-number" style="box-sizing:border-box; padding:0px 10px; width:50px; min-width:50px; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; line-height:20px; color:rgba(211,207,201,0.3); text-align:right; white-space:nowrap; vertical-align:top; border-right:0px">
</td>
<td id="x_gmail-LC222" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">Flags</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
name_info_flags</span>() | <span class="x_gmail-pl-c1" style="box-sizing:border-box; color:rgb(110,192,255)">
undefined</span>,</td>
</tr>
<tr style="box-sizing:border-box">
<td id="x_gmail-L223" class="x_gmail-blob-num x_gmail-js-line-number" style="box-sizing:border-box; padding:0px 10px; width:50px; min-width:50px; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; line-height:20px; color:rgba(211,207,201,0.3); text-align:right; white-space:nowrap; vertical-align:top; border-right:0px">
</td>
<td id="x_gmail-LC223" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">Info</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
name_info</span>(),</td>
</tr>
<tr style="box-sizing:border-box; background-color:transparent">
<td id="x_gmail-L224" class="x_gmail-blob-num x_gmail-js-line-number" style="box-sizing:border-box; padding:0px 10px; width:50px; min-width:50px; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; line-height:20px; color:rgba(211,207,201,0.3); text-align:right; white-space:nowrap; vertical-align:top; border-right:0px">
</td>
<td id="x_gmail-LC224" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">Reason</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
term</span>().</td>
</tr>
</tbody>
</table>
</div>
<div><br>
</div>
<div>Currently, the type is <span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">SockAddr</span><span style="color:rgb(216,212,207); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">
</span><span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">::</span><span style="color:rgb(216,212,207); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">
</span><span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">term</span><span style="color:rgb(216,212,207); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">(),
and could have been </span><span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">SockAddr</span><span style="color:rgb(216,212,207); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">
</span><span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">::</span><span style="color:rgb(216,212,207); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">
</span><span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">socket</span><span style="color:rgb(216,212,207); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">:</span><span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">sockaddr</span><span style="color:rgb(216,212,207); font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; white-space:pre; background-color:rgb(19,21,22)">().</span><br>
</div>
<div><br>
</div>
<div>I think fixing it in the source at <a href="https://protect2.fireeye.com/v1/url?k=bf7916a9-e0e22faf-bf795632-86ee86bd5107-5570f6b0d920cfb7&q=1&e=300a3de5-54c4-41b9-bbee-604bb9991333&u=https%3A%2F%2Fgithub.com%2Ferlang%2Fotp%2Fblob%2Fmaster%2Flib%2Fkernel%2Fsrc%2Fnet.erl%23L221">
L221</a> should fix it in the documentation as well. But please let me know if it doesn't.</div>
<div><br>
</div>
<div>However, I am myself confused about the way the type is specified, so thought I will discuss first before opening a PR. </div>
<div><br>
</div>
<div>It is not the net:getnameinfo/1 that I am confused, but about the net:getnameinfo/2. I don't understand the usage of
<b>ifndef</b> and <b>else </b>while specifying this type specification. If you could please point me to a place where I can understand these 2 better. I don't want to make wild guesses here while I am working through the foundations of Erlang.</div>
<div><br>
</div>
<div>It could have been simpler had this specification been written like below, even though whatever "ifdef" is doing out there is to be taken into consideration:-</div>
<div> </div>
<div>
<table class="x_gmail-highlight x_gmail-tab-size x_gmail-js-file-line-container" style="border-spacing:0px; border-collapse:collapse; color:rgb(216,212,207); font-size:14px; background-color:rgb(19,21,22)">
<tbody style="box-sizing:border-box">
<tr style="box-sizing:border-box">
<td id="x_gmail-LC215" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">SockAddr</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
socket</span>:<span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">sockaddr</span>() | term(),</td>
</tr>
<tr style="box-sizing:border-box; background-color:transparent">
<td id="x_gmail-L216" class="x_gmail-blob-num x_gmail-js-line-number" style="box-sizing:border-box; padding:0px 10px; width:50px; min-width:50px; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; line-height:20px; color:rgba(211,207,201,0.3); text-align:right; white-space:nowrap; vertical-align:top; border-right:0px">
</td>
<td id="x_gmail-LC216" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">Flags</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
name_info_flags</span>() | <span class="x_gmail-pl-c1" style="box-sizing:border-box; color:rgb(110,192,255)">
undefined</span>,</td>
</tr>
<tr style="box-sizing:border-box">
<td id="x_gmail-L217" class="x_gmail-blob-num x_gmail-js-line-number" style="box-sizing:border-box; padding:0px 10px; width:50px; min-width:50px; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; line-height:20px; color:rgba(211,207,201,0.3); text-align:right; white-space:nowrap; vertical-align:top; border-right:0px">
</td>
<td id="x_gmail-LC217" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">Info</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
name_info</span>(),</td>
</tr>
<tr style="box-sizing:border-box; background-color:transparent">
<td id="x_gmail-L218" class="x_gmail-blob-num x_gmail-js-line-number" style="box-sizing:border-box; padding:0px 10px; width:50px; min-width:50px; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace; font-size:12px; line-height:20px; color:rgba(211,207,201,0.3); text-align:right; white-space:nowrap; vertical-align:top; border-right:0px">
</td>
<td id="x_gmail-LC218" class="x_gmail-blob-code x_gmail-blob-code-inner x_gmail-js-file-line" style="box-sizing:border-box; padding:0px 10px; line-height:20px; vertical-align:top; overflow:visible; font-size:12px; white-space:pre; font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">
<span class="x_gmail-pl-smi" style="box-sizing:border-box; color:rgb(188,182,173)">Reason</span>
<span class="x_gmail-pl-k" style="box-sizing:border-box; color:rgb(255,115,105)">
::</span> <span class="x_gmail-pl-en" style="box-sizing:border-box; color:rgb(197,143,255)">
term</span>()</td>
</tr>
</tbody>
</table>
</div>
<div><br>
</div>
<div>Please let me know if there is any misconstrusion on my part. </div>
<div><br>
</div>
<div>Thanks and Regards</div>
<div>Nalin Ranjan</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div></div>
<div><font color="#cdc8c2" face="SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace" style=""><span style="font-size:12px; white-space:pre; background-color:rgb(15,17,17)"></span></font></div>
</div>
</div>
</body>
</html>