<?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[CAsyncSocket]]></title><description><![CDATA[<p>Hi</p>
<p>Ich hab ein Problem mit der CAsyncSocket Klasse. Aus irgend einem Grund kann ich damit keine Verbindung aufbauen bzw. bekomme ich von der Connect Funktion immer FALSE returned.</p>
<pre><code class="language-cpp">// FUNKTIONIERT NICHT
CAsyncSocket* ASock = new CAsyncSocket();
ASock-&gt;Create();
if(!ASock-&gt;Connect(&quot;localhost&quot;, 2000))
	AfxMessageBox(&quot;CONNECTION FAILED&quot;);
else{
	CString str = &quot;TEST&quot;;
	ASock-&gt;Send(str, str.GetLength());
}
ASock-&gt;Close();
delete ASock;
</code></pre>
<pre><code class="language-cpp">// FUNKTIONIERT JEDOCH PROBLEMLOS
CSocket* Sock = new CSocket();
Sock-&gt;Create();
if(!Sock-&gt;Connect(&quot;localhost&quot;, 2000))
	AfxMessageBox(&quot;CONNECTION FAILED&quot;);
else{
	CString str = &quot;TEST&quot;;
	Sock-&gt;Send(str, str.GetLength());
}
Sock-&gt;Close();
delete Sock;
</code></pre>
<p>Wo liegt das Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/170848/casyncsocket</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 16:35:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/170848.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Jan 2007 09:32:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 09:32:12 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>Ich hab ein Problem mit der CAsyncSocket Klasse. Aus irgend einem Grund kann ich damit keine Verbindung aufbauen bzw. bekomme ich von der Connect Funktion immer FALSE returned.</p>
<pre><code class="language-cpp">// FUNKTIONIERT NICHT
CAsyncSocket* ASock = new CAsyncSocket();
ASock-&gt;Create();
if(!ASock-&gt;Connect(&quot;localhost&quot;, 2000))
	AfxMessageBox(&quot;CONNECTION FAILED&quot;);
else{
	CString str = &quot;TEST&quot;;
	ASock-&gt;Send(str, str.GetLength());
}
ASock-&gt;Close();
delete ASock;
</code></pre>
<pre><code class="language-cpp">// FUNKTIONIERT JEDOCH PROBLEMLOS
CSocket* Sock = new CSocket();
Sock-&gt;Create();
if(!Sock-&gt;Connect(&quot;localhost&quot;, 2000))
	AfxMessageBox(&quot;CONNECTION FAILED&quot;);
else{
	CString str = &quot;TEST&quot;;
	Sock-&gt;Send(str, str.GetLength());
}
Sock-&gt;Close();
delete Sock;
</code></pre>
<p>Wo liegt das Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213069</guid><dc:creator><![CDATA[aerou]]></dc:creator><pubDate>Sat, 20 Jan 2007 09:32:12 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 11:24:29 GMT]]></title><description><![CDATA[<p>aerou schrieb:</p>
<blockquote>
<p>Wo liegt das Problem?</p>
</blockquote>
<p>Das Problem ist, dass dir anscheinend nicht klar ist, was das &quot;Async&quot; in CAsyncSocket bedeutet, und dass du ihn wie CSocket benutzt.</p>
<p>Wenn es mit CSocket klappt, dann benutzt das doch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213098</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213098</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 20 Jan 2007 11:24:29 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 11:27:05 GMT]]></title><description><![CDATA[<blockquote>
<p>Return Value<br />
Nonzero if the function is successful; otherwise 0, and a specific error code can be retrieved by calling GetLastError.</p>
</blockquote>
<p>So steht es zumindest in der MSDN zu &quot;CAsyncSocket::Connect&quot;.<br />
<a href="http://msdn2.microsoft.com/fr-fr/library/dxt965kz.aspx" rel="nofollow">http://msdn2.microsoft.com/fr-fr/library/dxt965kz.aspx</a></p>
<p>Daher habe ich angenommen, dass Connect dem zufolge dann auch true zurück liefern sollte wenn die Verbindung aufgebaut werden konnte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213101</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213101</guid><dc:creator><![CDATA[aerou]]></dc:creator><pubDate>Sat, 20 Jan 2007 11:27:05 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 11:44:11 GMT]]></title><description><![CDATA[<p>Hast du eventuell nehme ich an die Winsock Geschichte nicht initzialisiert ? Da gibts son Befehl damit da überhaupt was geht. Wenn du mit dem Assistenten das von Anfang an angibts das Winsock benuttz wird ist das mit drin aber sonst musste manuell machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213110</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213110</guid><dc:creator><![CDATA[DaRpH]]></dc:creator><pubDate>Sat, 20 Jan 2007 11:44:11 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 11:52:13 GMT]]></title><description><![CDATA[<p>Ja, die Sockets sollten eigentlich initialisiert sein.<br />
Deswegen funktioniert es ja auch mit dem CSocket. Aber ich versteh momentan nicht, warum es mit CAsyncSocket nicht geht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213115</guid><dc:creator><![CDATA[aerou]]></dc:creator><pubDate>Sat, 20 Jan 2007 11:52:13 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 12:49:00 GMT]]></title><description><![CDATA[<p>aerou schrieb:</p>
<blockquote>
<p>So steht es zumindest in der MSDN zu &quot;CAsyncSocket::Connect&quot;.</p>
</blockquote>
<p>Lies doch bitte mal genau an der Stelle, die du da zitiert hast, den nächsten Satz.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213144</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213144</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 20 Jan 2007 12:49:00 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 13:30:17 GMT]]></title><description><![CDATA[<blockquote>
<p>Return Value<br />
Nonzero if the function is successful; otherwise 0, and a specific error code can be retrieved by calling GetLastError. If this indicates an error code of WSAEWOULDBLOCK, and your application is using the overridable callbacks, your application will receive an OnConnect message when the connect operation is complete. The following errors apply to this member function: [...]</p>
</blockquote>
<p>Trotzdem sollte die Connect Funktion doch true returnen, wenn sie erfolgreich war, oder lieg ich da falsch? Die Error Codes kommen ja nur ins Spiel, wenn eben nicht connected werden konnte, also praktisch wenn false returned wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213167</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213167</guid><dc:creator><![CDATA[aerou]]></dc:creator><pubDate>Sat, 20 Jan 2007 13:30:17 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 13:52:39 GMT]]></title><description><![CDATA[<p>Die entscheidende Eigenschaft von asynchronen Funktionen ist, dass sie bisweilen zurückkommen, bevor der dadurch angestoßene Vorgang beendet ist. Es kann also sein, dass CAsyncSocket::Connect zurückkommt, bevor der Verbindungsvorgang abgeschlossen ist.</p>
<p>In so einem Fall passiert genau das, was in der MSDN Library beschrieben ist: Connect liefert FALSE, GetLastError liefert WSAEWOULDBLOCK, und OnConnect wird aufgerufen, wenn das Ganze beendet ist, sei es erfolgreich oder nicht.</p>
<p>Das musst du natürlich auch dementsprechend behandeln.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213180</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 20 Jan 2007 13:52:39 GMT</pubDate></item><item><title><![CDATA[Reply to CAsyncSocket on Sat, 20 Jan 2007 14:11:09 GMT]]></title><description><![CDATA[<p>Aha ok. Vielen Dank für die Informationen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213187</guid><dc:creator><![CDATA[aerou]]></dc:creator><pubDate>Sat, 20 Jan 2007 14:11:09 GMT</pubDate></item></channel></rss>