<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[gethostbyname() immer null]]></title><description><![CDATA[<p>Hallo,</p>
<p>hab ein Problem.Zuerst mal arbeite ich unter Linux.Ich bekomme nicht die ip von einem gewissen dns namen.Das hostent ist immer null.Ich frage mich warum?Ruf ich das vielleicht an der falschen Stelle auf?Wer kann mir da helfen?</p>
<pre><code class="language-cpp">string myDns = mySettings-&gt;GetDns();

host = gethostbyname(myDns.c_str());
if (host == NULL)
{
//blabla
}
</code></pre>
<p>MfG Ronnsen</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/204193/gethostbyname-immer-null</link><generator>RSS for Node</generator><lastBuildDate>Sun, 28 Jun 2026 03:21:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/204193.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 31 Jan 2008 07:47:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 07:47:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>hab ein Problem.Zuerst mal arbeite ich unter Linux.Ich bekomme nicht die ip von einem gewissen dns namen.Das hostent ist immer null.Ich frage mich warum?Ruf ich das vielleicht an der falschen Stelle auf?Wer kann mir da helfen?</p>
<pre><code class="language-cpp">string myDns = mySettings-&gt;GetDns();

host = gethostbyname(myDns.c_str());
if (host == NULL)
{
//blabla
}
</code></pre>
<p>MfG Ronnsen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446776</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446776</guid><dc:creator><![CDATA[joschika77]]></dc:creator><pubDate>Thu, 31 Jan 2008 07:47:57 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:01:18 GMT]]></title><description><![CDATA[<blockquote>
<p>RETURN VALUE<br />
The gethostbyname() and gethostbyaddr() functions return<br />
the hostent structure or a NULL pointer if an error<br />
occurs. On error, the h_errno variable holds an error<br />
number.</p>
</blockquote>
<p>Was für einen Fehlercode hat h_errno?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446781</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446781</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:01:18 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:09:42 GMT]]></title><description><![CDATA[<p>Da hab i auch schon gesucht und mich durchgewurschtelt. Bin zu dem Ergebnis gekommen:</p>
<blockquote>
<p>Resource temporarily unavailable</p>
</blockquote>
<p>Weiß nur nicht was das soll?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446786</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446786</guid><dc:creator><![CDATA[joschika77]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:09:42 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:11:17 GMT]]></title><description><![CDATA[<p>Aber auflösen kann dein Rechner den Namen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446791</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:11:17 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:13:53 GMT]]></title><description><![CDATA[<p>wie meinst das? also i hab konsole aufgerufen und &quot;ping dnsname&quot; eingetippt.<br />
und der anwortet.Seltsam das ist würde joda sagen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446794</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446794</guid><dc:creator><![CDATA[joschika77]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:13:53 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:16:28 GMT]]></title><description><![CDATA[<p>Und dein String ist korrekt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446796</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446796</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:16:28 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:25:52 GMT]]></title><description><![CDATA[<p>ja denke ich. Wie gesagt beim ping funzt es ja. Genau das gleiche habe ich ja auch in dem string. Aber der Auruf ist an der Stelle richtig ja?</p>
<p>[cpp]<br />
//also den code den ich oben gepostet habe kommt hier hin, sprich davor</p>
<p>sock = socket ( AF_INET, SOCK_STREAM, 0 );<br />
if (sock == -1)<br />
{<br />
return -1;<br />
}</p>
<p>memset ( &amp;addr, 0, sizeof ( addr ) );<br />
addr.sin_family = AF_INET;<br />
addr.sin_port = htons ( myPort );<br />
if(hasDns)<br />
memcpy(&amp;(addr.sin_addr),host-&gt;h_addr_list[0],4);<br />
else<br />
addr.sin_addr.s_addr = inet_addr ( myIp.c_str() );</p>
<p>connectError = connect ( sock, ( sockaddr* ) &amp;addr, sizeof ( addr ) );</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446801</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446801</guid><dc:creator><![CDATA[joschika77]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:25:52 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:30:12 GMT]]></title><description><![CDATA[<p>Wenn gethostbyname 0 zurückgibt, ist ja vollkommen egal was davor kommt.<br />
mySettings-&gt;GetDns() funktioniert? myDns enthält den richtigen String?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446803</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446803</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:30:12 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 08:38:32 GMT]]></title><description><![CDATA[<p>im string steht das richtige...kann aber auch mal hardcoden...ich muß dazu sagen das ich was für ne telematikbox progge und mich vorher ins gsm/gprs netz einwähle und darüber was verschicke. Die ip vom jeweiligen anbieter bekomme ich und dann dachte ich das ich dann die gethostbyname aufrufe. Also das verschicken über ip funzt auch. Vielleicht geht das irgendwie gar nicht...hmmmm... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446809</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446809</guid><dc:creator><![CDATA[joschika77]]></dc:creator><pubDate>Thu, 31 Jan 2008 08:38:32 GMT</pubDate></item><item><title><![CDATA[Reply to gethostbyname() immer null on Thu, 31 Jan 2008 09:34:05 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-403.html" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-8.html" rel="nofollow">Rund um die Programmierung</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1446832</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1446832</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Thu, 31 Jan 2008 09:34:05 GMT</pubDate></item></channel></rss>