<?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[host in ip umwandeln]]></title><description><![CDATA[<p>ich will den host &quot;<a href="http://de66.die-staemme.de" rel="nofollow">de66.die-staemme.de</a>&quot; in die ip umwandeln.</p>
<p>gethostbyname() und inet_addr() versagen irgendwie und liefern keine ip.</p>
<p>weis einer wiso? und welche funktion geht?</p>
<p>von inet_addr() der code:</p>
<pre><code class="language-cpp">const char* ipserver = server.c_str();
    ip = inet_addr(ipserver);
</code></pre>
<p>und von gethostbyname():</p>
<pre><code class="language-cpp">unsigned long GetIP( string Host) 
{ 
    struct hostent* HomeP; 
    unsigned long HostIp; 

    HostIp = inet_addr( Host.c_str() ); 
    if( HostIp == INADDR_NONE ) 
    { 
        HomeP = gethostbyname( Host.c_str() ); 
        if( !HomeP ) 
        { 
            return 0; 
        } 
        else HostIp = *(unsigned long *)HomeP-&gt;h_addr; 
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/276696/host-in-ip-umwandeln</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 07:32:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/276696.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Nov 2010 21:14:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to host in ip umwandeln on Sat, 06 Nov 2010 21:14:36 GMT]]></title><description><![CDATA[<p>ich will den host &quot;<a href="http://de66.die-staemme.de" rel="nofollow">de66.die-staemme.de</a>&quot; in die ip umwandeln.</p>
<p>gethostbyname() und inet_addr() versagen irgendwie und liefern keine ip.</p>
<p>weis einer wiso? und welche funktion geht?</p>
<p>von inet_addr() der code:</p>
<pre><code class="language-cpp">const char* ipserver = server.c_str();
    ip = inet_addr(ipserver);
</code></pre>
<p>und von gethostbyname():</p>
<pre><code class="language-cpp">unsigned long GetIP( string Host) 
{ 
    struct hostent* HomeP; 
    unsigned long HostIp; 

    HostIp = inet_addr( Host.c_str() ); 
    if( HostIp == INADDR_NONE ) 
    { 
        HomeP = gethostbyname( Host.c_str() ); 
        if( !HomeP ) 
        { 
            return 0; 
        } 
        else HostIp = *(unsigned long *)HomeP-&gt;h_addr; 
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1976370</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1976370</guid><dc:creator><![CDATA[bammes]]></dc:creator><pubDate>Sat, 06 Nov 2010 21:14:36 GMT</pubDate></item><item><title><![CDATA[Reply to host in ip umwandeln on Sat, 06 Nov 2010 21:30:01 GMT]]></title><description><![CDATA[<p>Und warum geht es nicht? Fehlerbeschreibung??? Erkläre das Problem genauer.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1976383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1976383</guid><dc:creator><![CDATA[hjghjg]]></dc:creator><pubDate>Sat, 06 Nov 2010 21:30:01 GMT</pubDate></item><item><title><![CDATA[Reply to host in ip umwandeln on Sat, 06 Nov 2010 21:45:01 GMT]]></title><description><![CDATA[<p>wenn ich bei der funktion das &quot;return 0&quot; wegmache kommt folgender Fehler:</p>
<p>Unbehandelte Ausnahme bei 0x00a11787 in dsbot.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x0000000c.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1976396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1976396</guid><dc:creator><![CDATA[bammes]]></dc:creator><pubDate>Sat, 06 Nov 2010 21:45:01 GMT</pubDate></item><item><title><![CDATA[Reply to host in ip umwandeln on Sun, 07 Nov 2010 00:34:08 GMT]]></title><description><![CDATA[<p>Beide Funktionen liefern nur den unsigned long Wert, den du für connect brauchst.</p>
<p>Das hat mit der IP-Darstellung, die du meinst nichts zu tun.</p>
<p>Lies erst mal die Spezifikationen der beiden Funktionen und dann die von inet_ntoa (<a href="http://msdn.microsoft.com/en-us/library/ms738564%28VS.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms738564(VS.85).aspx</a>).</p>
<p>Kannst dir ja mal das hier ansehen (google top ten):<br />
<a href="http://www.cplusplus.com/forum/articles/9742/" rel="nofollow">http://www.cplusplus.com/forum/articles/9742/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1976443</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1976443</guid><dc:creator><![CDATA[EOP]]></dc:creator><pubDate>Sun, 07 Nov 2010 00:34:08 GMT</pubDate></item><item><title><![CDATA[Reply to host in ip umwandeln on Sun, 07 Nov 2010 01:12:54 GMT]]></title><description><![CDATA[<p>????<br />
weis doch dass beide diesen unsigned long zurückgeben.</p>
<p>also</p>
<p>meine funktion hat bis jetzt ja einwandfrei gefunzt nur <a href="http://de66.die-staemme.de" rel="nofollow">de66.die-staemme.de</a> klappt net.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1976450</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1976450</guid><dc:creator><![CDATA[bammes]]></dc:creator><pubDate>Sun, 07 Nov 2010 01:12:54 GMT</pubDate></item><item><title><![CDATA[Reply to host in ip umwandeln on Sun, 07 Nov 2010 08:03:38 GMT]]></title><description><![CDATA[<blockquote>
<p>Note The gethostbyname function has been deprecated by the introduction of the getaddrinfo function. Developers creating Windows Sockets 2 applications are urged to use the getaddrinfo function instead of gethostbyname.</p>
</blockquote>
<p>Versuchs mal mit getaddrinfo.<br />
<a href="http://msdn.microsoft.com/en-us/library/ms738520%28v=VS.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms738520(v=VS.85).aspx</a></p>
<p>Was du meinst ist nicht die IP sondern die aufgelöste Adresse.<br />
127.0.0.1 ist z.B. eine IP.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1976482</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1976482</guid><dc:creator><![CDATA[EOP]]></dc:creator><pubDate>Sun, 07 Nov 2010 08:03:38 GMT</pubDate></item><item><title><![CDATA[Reply to host in ip umwandeln on Sun, 07 Nov 2010 18:52:15 GMT]]></title><description><![CDATA[<p>ich kapier die letzten 2 parameter net so ganz</p>
<blockquote>
<p>pHints [in, optional]</p>
<p>A pointer to an addrinfo structure that provides hints about the type of socket the caller supports. See Remarks for more details.<br />
ppResult [out]</p>
<p>A pointer to a linked list of one or more addrinfo structures that contains response information about the host.</p>
</blockquote>
<p>was was sind die und wie müssen sie deklariert werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1976837</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1976837</guid><dc:creator><![CDATA[bammes]]></dc:creator><pubDate>Sun, 07 Nov 2010 18:52:15 GMT</pubDate></item></channel></rss>