<?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[Gelöscht]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/230065/gelöscht</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Apr 2026 00:00:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/230065.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Dec 2008 19:18:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Gelöscht on Mon, 21 Jan 2013 11:09:57 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633070</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633070</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 21 Jan 2013 11:09:57 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Fri, 19 Dec 2008 19:31:19 GMT]]></title><description><![CDATA[<p>Du schickst dem Client einfach Daten...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633077</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633077</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 19 Dec 2008 19:31:19 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Mon, 21 Jan 2013 11:10:10 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633088</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633088</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 21 Jan 2013 11:10:10 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Fri, 19 Dec 2008 23:41:57 GMT]]></title><description><![CDATA[<p>ja, select.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633149</guid><dc:creator><![CDATA[hallo winsock]]></dc:creator><pubDate>Fri, 19 Dec 2008 23:41:57 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Sat, 20 Dec 2008 02:35:30 GMT]]></title><description><![CDATA[<p>Du solltest dir sowieso überlegen welches IO Modell du verwendest.</p>
<p>select() mit blocking Sockets ist IMO problematisch, weil es theoretisch sein kann dass man von select geweckt wird, der recv/send/accept Call aber dann trotzdem blockiert -- und dann u.U. sehr lange blockiert. Und dann steht der Server, was garnicht gut ist.</p>
<p>Blocking IO ist IMO nur mit Threads wirklich zu gebrauchen.</p>
<p>Das &quot;reactive IO&quot; Modell (auch als &quot;asynchronous IO&quot; bekannt) verwendet select() mit non-blocking Sockets. Funktioniert grundsätzlich recht gut, boss für wirklich gute Performance, speziell auf Multi-Core Maschinen nicht optimal.</p>
<p>Das &quot;proactive IO&quot; Modell verwendet z.B. IO Completion Ports. Skaliert sehr gut, und lässt sich auch sehr einfach mit Thread-Pools kombinieren.</p>
<p>Wenn du dich für ein bestimmtes Modell entschieden hast sollte dann auch klar sein wie du das mit Verbindungen annehmen hinbekommst ohne den Server zu blockieren, oder wie du mitbekommst wenn ein Client sich getrennt hat.</p>
<p>Dazu noch ein Hinweis: theoretisch reicht es wenn der Server in einem recv() wartet dass vom Client was kommt. Wenn dieser die Verbindung &quot;aktiv trennt&quot;, dann kommt recv() mit 0 zurück (bzw. wird die Completion-Routine mit entsprechenden Parametern aufgerufen). Blöd ist nur wenn der Client einfach &quot;wegstirbt&quot;, d.h. wenn vom Client kein &quot;RST&quot; Paket geschickt wird, der aber trotzdem einfach &quot;weg&quot; ist. In dem Fall kann es *sehr* lange dauern bis der dein Server-Programm die Info bekommt &quot;Client ist futsch&quot;. Um solche Fälle schneller mitzubekommen ist es gut wenn man in periodischen Abständen &quot;Dummy Pakete&quot; zwischen Client und Server hin und herschickt. Wenn definiert ist dass jede Minute so ein Paket geschickt werden muss, und der Server hört z.B. 10 Minuten von einem Client nichts mehr, dann kann er die Verbindung einfach trennen. Bzw. wird der Server schneller vom TCP/IP Stack auch viel schneller die Info bekommen dass der Client weg ist, wenn der Server versucht selbst so ein Paket zu senden.<br />
Von daher ist es günstig solche Dummy-Pakete zu senden, wenn man die Möglichkeit dazu hat (d.h. wenn es das Protokoll welches man verwendet ermöglicht, bzw. man das Protokoll selbst definieren kann).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633170</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633170</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 20 Dec 2008 02:35:30 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Sat, 20 Dec 2008 04:43:48 GMT]]></title><description><![CDATA[<blockquote>
<p>Das &quot;reactive IO&quot; Modell (<strong>auch als &quot;asynchronous IO&quot; bekannt</strong>)</p>
</blockquote>
<p>Falsch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633181</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633181</guid><dc:creator><![CDATA[flasch]]></dc:creator><pubDate>Sat, 20 Dec 2008 04:43:48 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Sat, 20 Dec 2008 05:43:52 GMT]]></title><description><![CDATA[<p>flasch schrieb:</p>
<blockquote>
<blockquote>
<p>Das &quot;reactive IO&quot; Modell (<strong>auch als &quot;asynchronous IO&quot; bekannt</strong>)</p>
</blockquote>
<p>Falsch</p>
</blockquote>
<p>Genaugenommen falsch, von mir aus.</p>
<p>Wenn allerdings irgendwo bloss &quot;asynchronous IO&quot; steht, ohne weitere Angaben, und es um Sockets geht, dann ist normalerweise das reaktive Modell gemeint. Genauer: select().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633185</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 20 Dec 2008 05:43:52 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Sat, 20 Dec 2008 05:59:04 GMT]]></title><description><![CDATA[<blockquote>
<p>The Reactor patterns involve synchronous I/O, whereas the Proactor pattern involves asynchronous I/O</p>
</blockquote>
<p><a href="http://www.artima.com/articles/io_design_patterns2.html" rel="nofollow">http://www.artima.com/articles/io_design_patterns2.html</a></p>
<p><a href="http://en.wikipedia.org/wiki/Reactor_pattern" rel="nofollow">http://en.wikipedia.org/wiki/Reactor_pattern</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633188</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633188</guid><dc:creator><![CDATA[flasch]]></dc:creator><pubDate>Sat, 20 Dec 2008 05:59:04 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Sat, 20 Dec 2008 06:16:47 GMT]]></title><description><![CDATA[<p>Irgendwas zu zitieren ändert nichts daran dass der Begriff in der Art verwendet wird, wie er nunmal verwendet wird.</p>
<p>Siehe auch <a href="http://en.wikipedia.org/wiki/Asynchronous_I/O" rel="nofollow">http://en.wikipedia.org/wiki/Asynchronous_I/O</a> - wenn du aufpasst wird dir vielleicht auffallen dass dort explizit select() erwähnt wird. select() mit non-blocking Sockets ist nunmal asynchron.</p>
<p>EDIT: oder auch hier: <a href="http://www.ibm.com/developerworks/linux/library/l-async/index.html" rel="nofollow">http://www.ibm.com/developerworks/linux/library/l-async/index.html</a><br />
Absatz &quot;Asynchronous blocking I/O&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633191</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633191</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 20 Dec 2008 06:16:47 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Sat, 20 Dec 2008 10:45:45 GMT]]></title><description><![CDATA[<p>sk0r schrieb:</p>
<blockquote>
<p>Hallo,</p>
<p>wie kann ich per WinSocks als Server überprüfen,<br />
ob ein Client nicht mehr verbunden ist? Ich habe nämlich<br />
eine struct, welche Events bereitstellt, u.a. auch OnDisconnect.<br />
Wie kann ich nun überprüfen, ob ein Client nicht mehr mit dem<br />
Server verbunden ist, wegen welchem Grund auch immer?!</p>
<p>MfG: sk0r</p>
</blockquote>
<p>Hi,</p>
<p>verwende WSAEventSelect() oder WSAAsyncSelect() (wenn Du eine GUI hast) so kannst Du auf das FD_CLOSE - Event oder FD_CLOSE - Nachricht warten lassen, ohne Schleife.</p>
<p>Ein (noch unfertiges) Beispiel eines Client-Threads mit WSAEventSelect(), hier werden: FD_READ und FD_CLOSE ausgewertet:</p>
<pre><code class="language-cpp">DWORD WINAPI MOSVR_ClientThread(SOCKET hClient){
	SOCKET mySock = hClient;
	static char *si = MOSVR_GetResString(300);

	::send(mySock, si, strlen(si), 0);

	WSAEVENT wEvent = ::WSACreateEvent();
	if(wEvent == WSA_INVALID_EVENT) return 1;
	if(::WSAEventSelect(mySock, wEvent, FD_CLOSE | FD_READ) == SOCKET_ERROR) return 1;
	WSAEVENT wEar[1] = { wEvent };
	WSANETWORKEVENTS wE;

	for(;;){
		ZeroMemory(&amp;wE, sizeof(wE));

		DWORD dwrVal = ::WSAWaitForMultipleEvents(1, wEar, false, WSA_INFINITE, false);
		if(dwrVal == WSA_WAIT_FAILED) break;
        if(::WSAEnumNetworkEvents(mySock, wEar[0], &amp;wE) != SOCKET_ERROR){
			switch(wE.lNetworkEvents){
				case FD_READ:
					MOSVR_ReadClientCommands(mySock);
					break;
				case FD_CLOSE:
					::WSACloseEvent(wEvent);
					::closesocket(mySock);
					return 0;
			}
		}
		::WSAResetEvent(wEar[0]);
	}

	::WSAEventSelect(mySock, wEvent, 0);
	::WSACloseEvent(wEvent);
	::closesocket(mySock);
	return 0;
}
</code></pre>
<p>Der Client läuft in einem Service, hier ist eine GUI nicht möglich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1633228</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1633228</guid><dc:creator><![CDATA[CStern]]></dc:creator><pubDate>Sat, 20 Dec 2008 10:45:45 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Mon, 21 Jan 2013 11:10:39 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1635214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1635214</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 21 Jan 2013 11:10:39 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Fri, 26 Dec 2008 03:50:53 GMT]]></title><description><![CDATA[<p>Der &quot;beliebteste&quot; Fehler beim Thema Socket-Programmierung, ist, dass Leute glauben &quot;recv&quot; würde &quot;Pakete&quot; empfangen, so wie sie mit &quot;send&quot; abgeschickt werden. Das ist nicht so. Es gibt bei Stream-Sockets keine &quot;Paketgrenzen&quot; oder &quot;Nachrichtengrenzen&quot;. Wenn du 2x send mit je 100 Byte machst, kann es sein, dass ein einziges recv die ganzen 200 Byte empfängt. Oder auch nur 150 byte, oder gar nur 1 Byte.</p>
<p>Was mich gleich zum zweit-beliebtesten Fehler bringt: manche Leute nehmen an dass recv genau so viel Byte empfängt wie man &quot;verlangt&quot;. Das ist auch nicht so. recv empfängt von 1 bis N Byte, bzw. bei nonblocking Sockets von 0 bis N Byte.</p>
<p>Lies die Doku, sehr genau, steht alles drin was man wissen muss <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/1635658</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1635658</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 26 Dec 2008 03:50:53 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Mon, 21 Jan 2013 11:10:53 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1656010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1656010</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 21 Jan 2013 11:10:53 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Sun, 01 Feb 2009 15:46:55 GMT]]></title><description><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/ms740121(VS.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms740121(VS.85).aspx</a><br />
die Doku ist teilweise auch auf Deutsch verfügbar, recv() gehört aber glaube ich nicht dazu...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1656016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1656016</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sun, 01 Feb 2009 15:46:55 GMT</pubDate></item><item><title><![CDATA[Reply to Gelöscht on Mon, 21 Jan 2013 11:11:03 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1714758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1714758</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 21 Jan 2013 11:11:03 GMT</pubDate></item></channel></rss>