<?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[Server online&#x2F;offline]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich würde gerne mit einem C++ WindowsProgramm kontrolieren ob verschiedene Dienste (z.B. Apache, MySQL, TS, IRC, FTP, ...) auf meinem Server online oder offline sind.<br />
bisher hab ich sowas immer in TCL geschrieben, aber nun wollte ich das ganz in C++ machen.<br />
Nur hab ich keine Ahnung wie ich eine Socket verbindung in C++ aufbauen kann.</p>
<p>könnte mir das vllt. mal jemand anhand eines Beispieles mit den untenstehenden daten zeigen?<br />
Apache:<br />
IP: 123.123.123.123<br />
Port: 80</p>
<p>Ich hab mir da ne Funktion vorgestellt, die 1 zurückliefert wenn der dienst online ist, und 0 wenn er offline ist.</p>
<p>Währe euch sehr dankbar</p>
<p>Weble</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/123816/server-online-offline</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 01:12:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123816.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Oct 2005 14:22:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Server online&#x2F;offline on Thu, 20 Oct 2005 14:22:47 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich würde gerne mit einem C++ WindowsProgramm kontrolieren ob verschiedene Dienste (z.B. Apache, MySQL, TS, IRC, FTP, ...) auf meinem Server online oder offline sind.<br />
bisher hab ich sowas immer in TCL geschrieben, aber nun wollte ich das ganz in C++ machen.<br />
Nur hab ich keine Ahnung wie ich eine Socket verbindung in C++ aufbauen kann.</p>
<p>könnte mir das vllt. mal jemand anhand eines Beispieles mit den untenstehenden daten zeigen?<br />
Apache:<br />
IP: 123.123.123.123<br />
Port: 80</p>
<p>Ich hab mir da ne Funktion vorgestellt, die 1 zurückliefert wenn der dienst online ist, und 0 wenn er offline ist.</p>
<p>Währe euch sehr dankbar</p>
<p>Weble</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896864</guid><dc:creator><![CDATA[Weble]]></dc:creator><pubDate>Thu, 20 Oct 2005 14:22:47 GMT</pubDate></item><item><title><![CDATA[Reply to Server online&#x2F;offline on Thu, 20 Oct 2005 15:03:16 GMT]]></title><description><![CDATA[<p>kannste auch selber machen. wie es geht steht im internet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896903</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896903</guid><dc:creator><![CDATA[Webbi]]></dc:creator><pubDate>Thu, 20 Oct 2005 15:03:16 GMT</pubDate></item><item><title><![CDATA[Reply to Server online&#x2F;offline on Thu, 20 Oct 2005 15:05:23 GMT]]></title><description><![CDATA[<p><a href="http://www.c-worker.ch" rel="nofollow">www.c-worker.ch</a></p>
<p>und im winapi forum (bzw. dos/win32konsole forum) suchen.<br />
standard c++ ist der falsche ort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896906</guid><dc:creator><![CDATA[elise]]></dc:creator><pubDate>Thu, 20 Oct 2005 15:05:23 GMT</pubDate></item><item><title><![CDATA[Reply to Server online&#x2F;offline on Thu, 20 Oct 2005 17:09:53 GMT]]></title><description><![CDATA[<p>thx, aber jetzt hab ich ein kleines problem:</p>
<pre><code class="language-cpp">#include &lt;winsock2.h&gt;
#include &lt;windows.h&gt;

WSADATA wsaData;
if (WSAStartup(MAKEWORD(2,2), &amp;wsaData))
{
  fehler = &quot;WSAStartup() failed, %lu\n&quot;, (unsigned long)GetLastError();
  fehlercode-&gt;Lines-&gt;Add(fehler);
} 
else {
  fehlercode-&gt;Lines-&gt;Add(&quot;WSA gestartet&quot;);
}
struct sockaddr_in {
  short int		sin_family;  /* AF_INET     */
  unsigned short int	sin_port;    /* Port-Nummer */
  struct in_addr	sin_addr;    /* IP-Adresse  */
};
struct sockaddr_in addr;
int s;
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s == -1)
{
  fehler = &quot;socket() failed&quot;;
  fehlercode-&gt;Lines-&gt;Add(fehler);
} else {
  fehlercode-&gt;Lines-&gt;Add(&quot;Socket erstellt&quot;);
}
  addr.sin_addr.s_addr = inet_addr(&quot;127.0.0.1&quot;);
  addr.sin_port = htons(9900);
  addr.sin_family = AF_INET;
if (connect(s, (sockaddr*) &amp;addr, sizeof(addr)) == -1)
{
  fehler = WSAGetLastError();
  fehlercode-&gt;Lines-&gt;Add(fehler);
} else {
  fehlercode-&gt;Lines-&gt;Add(&quot;Verbindung hergestellt&quot;);
}
</code></pre>
<p>(Es wurde alles unnötige entfernt und nur das gepostet, das zum winsock gehört)</p>
<p>naja ich bekomm folgendes:</p>
<blockquote>
<p>WSA gestartet<br />
Socket erstellt<br />
10014</p>
</blockquote>
<p>10014 == Bad address.</p>
<p>Ich finde den Fehler einfach net <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Weble</p>
]]></description><link>https://www.c-plusplus.net/forum/post/897015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/897015</guid><dc:creator><![CDATA[Weble]]></dc:creator><pubDate>Thu, 20 Oct 2005 17:09:53 GMT</pubDate></item><item><title><![CDATA[Reply to Server online&#x2F;offline on Thu, 20 Oct 2005 17:37:24 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">fehlercode-&gt;Lines-&gt;Add(&quot;WSA gestartet&quot;); // sieht nicht nach einem fehler aus
// ...
int s = socket(AF_INET, SOCK_STREAM, 0);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/897054</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/897054</guid><dc:creator><![CDATA[terraner]]></dc:creator><pubDate>Thu, 20 Oct 2005 17:37:24 GMT</pubDate></item><item><title><![CDATA[Reply to Server online&#x2F;offline on Thu, 20 Oct 2005 20:56:45 GMT]]></title><description><![CDATA[<p>thx</p>
<p>der fehler lag vllt. auch an dem socket(AF_I.....</p>
<p>aber der hauptfehler war woll der:</p>
<pre><code class="language-cpp">if (connect(s, (sockaddr*) &amp;addr, sizeof(addr)) == -1)
</code></pre>
<p>so gehörts richtig:</p>
<pre><code class="language-cpp">if (connect(s, (sockaddr*) &amp;addr, sizeof(sockaddr)) == -1)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/897233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/897233</guid><dc:creator><![CDATA[Weble]]></dc:creator><pubDate>Thu, 20 Oct 2005 20:56:45 GMT</pubDate></item><item><title><![CDATA[Reply to Server online&#x2F;offline on Thu, 20 Oct 2005 21:29:36 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" 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/897249</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/897249</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Thu, 20 Oct 2005 21:29:36 GMT</pubDate></item><item><title><![CDATA[Reply to Server online&#x2F;offline on Fri, 21 Oct 2005 09:14:30 GMT]]></title><description><![CDATA[<p>Weble schrieb:</p>
<blockquote>
<pre><code class="language-cpp">fehler = &quot;WSAStartup() failed, %lu\n&quot;, (unsigned long)GetLastError();
</code></pre>
</blockquote>
<p>Wat'n dat? An der Stelle solltest du dir auf jeden Fall mal die Funktionsweise des Komma-Operators erklären lassen (oder gleich umsteigen auf sprintf())</p>
]]></description><link>https://www.c-plusplus.net/forum/post/897499</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/897499</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 21 Oct 2005 09:14:30 GMT</pubDate></item></channel></rss>