<?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[Problem mit Client-Programmierung]]></title><description><![CDATA[<p>Ich bin grade dabei einen Client zu Programmieren.<br />
Jetzt soll sich aber der Client z.B zu einer Webseite verbinden.<br />
Jetzt will ich aber nur den Host angeben und nicht die Ip Adresse wie mache ich dies am besten?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194004/problem-mit-client-programmierung</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 05:49:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194004.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Oct 2007 16:26:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Client-Programmierung on Tue, 02 Oct 2007 16:26:18 GMT]]></title><description><![CDATA[<p>Ich bin grade dabei einen Client zu Programmieren.<br />
Jetzt soll sich aber der Client z.B zu einer Webseite verbinden.<br />
Jetzt will ich aber nur den Host angeben und nicht die Ip Adresse wie mache ich dies am besten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1376741</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1376741</guid><dc:creator><![CDATA[User500]]></dc:creator><pubDate>Tue, 02 Oct 2007 16:26:18 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Client-Programmierung on Tue, 02 Oct 2007 17:00:21 GMT]]></title><description><![CDATA[<p>Ich denke mal, <a href="http://msdn2.microsoft.com/en-us/library/ms738524.aspx" rel="nofollow">das</a> sollte dir helfen.</p>
<p>ph4nt0m</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1376771</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1376771</guid><dc:creator><![CDATA[ph4nt0m]]></dc:creator><pubDate>Tue, 02 Oct 2007 17:00:21 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Client-Programmierung on Tue, 02 Oct 2007 22:24:39 GMT]]></title><description><![CDATA[<p>lol, ein bisschen Eigeninitiative würde Dir aber auch nicht schaden... . Zu dem Thema gibts doch an allen Ecken was, außerdem zum Beispiel:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-169861.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-169861.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1376928</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1376928</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Tue, 02 Oct 2007 22:24:39 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Client-Programmierung on Wed, 03 Oct 2007 12:57:06 GMT]]></title><description><![CDATA[<p>Hmmm was muss ich den am Code änderen das sich der Client zu ner WebSeite Verbindet:</p>
<pre><code class="language-cpp">SOCKADDR_IN addrServer; 
  addrServer.sin_family = AF_INET; 
  addrServer.sin_addr.s_addr = inet_addr(ip); 
  addrServer.sin_port = htons(Port);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1377107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377107</guid><dc:creator><![CDATA[User500]]></dc:creator><pubDate>Wed, 03 Oct 2007 12:57:06 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Client-Programmierung on Wed, 03 Oct 2007 15:42:10 GMT]]></title><description><![CDATA[<p>Kann mir den niemand helfen?<br />
Alleine Kriege ich das nicht hin.<br />
-.-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377233</guid><dc:creator><![CDATA[User500]]></dc:creator><pubDate>Wed, 03 Oct 2007 15:42:10 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Client-Programmierung on Wed, 03 Oct 2007 17:17:03 GMT]]></title><description><![CDATA[<p>nix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377365</guid><dc:creator><![CDATA[tenchou]]></dc:creator><pubDate>Wed, 03 Oct 2007 17:17:03 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Client-Programmierung on Wed, 03 Oct 2007 17:27:23 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">sockaddr_in addr;
ZeroMemory(&amp;addr, sizeof(sockaddr_in));
// iPort ist der Port
addr.sin_port = htons(iPort);
addr.sin_family = AF_INET;
// pHost ist entweder die IP oder der Servername, dieser Code nimmt beides
addr.sin_addr.s_addr = inet_addr(pHost);
if (addr.sin_addr.s_addr == INADDR_NONE)
{ // Das wird ausgeführt, wenn pHost NICHT die IP war!
	hostent* info = gethostbyname(pHost);
	if (!info) // Der angegebene Webserver existiert gar nicht oder kann nicht gefunden werden
	{
		// irgend eine Fehlermeldung
		MessageBox(GetDesktopWindow(), &quot;Fehler: Der angegeben Server wurde nicht gefunden!&quot;, &quot;Fehler!&quot;, MB_OK|MB_ICONERROR);
	}
	memcpy((void*)&amp;(addr.sin_addr.s_addr), info-&gt;h_addr_list[0], sizeof(in_addr));
	// Der Webserver wurde gefunden...
}
</code></pre>
<p>Nach diesem Code hast du eine fertig ausgefüllte sockaddr_in Struktur</p>
<p>pHost ist ein char* oder char[].<br />
iPort ist irgend ein Integer-Typ.</p>
<p>MfG DrakoXP</p>
<p>PS.: es wäre nützlich, hinter der Fehlermeldung einen Abbruch<br />
(zum Beispiel return, wenn das ganze in einer Funktion statt findet)<br />
einzubauen, da es keinen Sinn macht das ganze fortzusetzen, wenn<br />
der Server nicht gefunden werden konnt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377367</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Wed, 03 Oct 2007 17:27:23 GMT</pubDate></item></channel></rss>