<?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[einen mit beginthread begonnen thread schließen]]></title><description><![CDATA[<p>hi!<br />
ich habe mit beginthread einen thread begonnen.<br />
Kann ich den außerhalb des threads auch wieder schließen?<br />
endthread() funktioniert ja nur innterhlab des threads.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/223957/einen-mit-beginthread-begonnen-thread-schließen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 21:24:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/223957.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Oct 2008 10:08:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Fri, 03 Oct 2008 10:08:00 GMT]]></title><description><![CDATA[<p>hi!<br />
ich habe mit beginthread einen thread begonnen.<br />
Kann ich den außerhalb des threads auch wieder schließen?<br />
endthread() funktioniert ja nur innterhlab des threads.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1592817</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1592817</guid><dc:creator><![CDATA[markusxxxx]]></dc:creator><pubDate>Fri, 03 Oct 2008 10:08:00 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Fri, 03 Oct 2008 12:39:37 GMT]]></title><description><![CDATA[<p>Dann solltest Du dem Thread durch ein Event oder ein Flag signalisieren, dass er sich selbst beenden soll.<br />
Man kann einen Thread nicht von außen terminieren. Das muss der Thread selbst tun, wenn man nicht gravierende Ressource-Leaks in Kauf nehmen will.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1592912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1592912</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 03 Oct 2008 12:39:37 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Fri, 03 Oct 2008 12:51:35 GMT]]></title><description><![CDATA[<p>also ich erkläre mal. Ich habe 2 Button. Einen Connect und einen Stop<br />
bei Connect wird der thread ausgeführt bei dem er sockets verbindet.<br />
in diesem thread befinden sich natürlich funktionen die blocken (connect) usw.<br />
Der 2 Soll es stoppen. Aber wie soll ich das Stoppen außer den Thread zu terminieren? hier mal code:</p>
<pre><code class="language-cpp">case IDC_BUTTON2:
				  GetDlgItemText(hDlg, IDC_BUTTON2, buffButton, sizeof(buffButton));
				  if(buffButton[0] == 'S')
				  {
					  SetDlgItemText(hDlg, IDC_BUTTON2, &quot;Waiting...&quot;);
				      _beginthread (Thread1, 0, 0);
				      _beginthread (Thread2, 0, 0);
				      _beginthread (Thread3, 0, 0);
				  }
				  return TRUE;
</code></pre>
<p>das ist der Stop:</p>
<pre><code class="language-cpp">case IDC_BUTTON3:
				  SetDlgItemText(hDlg, IDC_BUTTON2, &quot;Start Server&quot;);
				  return TRUE;
</code></pre>
<p>hier noch die socket und threads</p>
<pre><code class="language-cpp">SOCKET connectSocket(unsigned port)
{
	WSADATA wsa;
	SOCKADDR_IN addr;
	SOCKET acceptSocket, connectedSocket;
	if(WSAStartup(MAKEWORD(2,0), &amp;wsa) != 0)
	{
		return SOCKET_ERROR;
	}
	acceptSocket = socket(AF_INET,SOCK_STREAM,0);
	if(acceptSocket==INVALID_SOCKET)
	{
		return SOCKET_ERROR;
	}
	memset(&amp;addr,0,sizeof(SOCKADDR_IN));
	addr.sin_family=AF_INET;
	addr.sin_port=htons(port);
	addr.sin_addr.s_addr=INADDR_ANY;
	if(bind(acceptSocket,(SOCKADDR*)&amp;addr,sizeof(SOCKADDR_IN)) == SOCKET_ERROR)
	{
		return SOCKET_ERROR;
	}
	if(listen(acceptSocket,10)==SOCKET_ERROR)
	{
		return SOCKET_ERROR;
	}
	connectedSocket=accept(acceptSocket,NULL,NULL);
	if(connectedSocket==INVALID_SOCKET)
	{
		return SOCKET_ERROR;
	}
	return connectedSocket;
}

void Thread1 (PVOID pvoid)
{
	s1 = connectSocket(40791);
	if(s1 == SOCKET_ERROR)
	{
		SetDlgItemText(FindWindow(0, &quot;name&quot;), IDC_BUTTON2, &quot;Start&quot;);
		MessageBox(0, &quot;Konnte nicht verbinden!&quot;, szAppName, MB_ICONERROR);
	}
    _endthread () ;
}

void Thread2 (PVOID pvoid)
{
	s2 = connectSocket(40792);
	if(s2 == SOCKET_ERROR)
	{
		SetDlgItemText(FindWindow(0, &quot;name&quot;), IDC_BUTTON2, &quot;Start&quot;);
		MessageBox(0, &quot;Konnte nicht verbinden!&quot;, szAppName, MB_ICONERROR);
	}
    _endthread () ;
}

void Thread3 (PVOID pvoid)
{
	s3 = connectSocket(40793);
	if(s3 == SOCKET_ERROR)
	{
		SetDlgItemText(FindWindow(0, &quot;name&quot;), IDC_BUTTON2, &quot;Start&quot;);
		MessageBox(0, &quot;Konnte nicht verbinden!&quot;, szAppName, MB_ICONERROR);
	}
	else
		SetDlgItemText(FindWindow(0, &quot;Watch Out&quot;), IDC_BUTTON2, &quot;Connected&quot;);
    _endthread () ;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1592920</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1592920</guid><dc:creator><![CDATA[markusxxxx]]></dc:creator><pubDate>Fri, 03 Oct 2008 12:51:35 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Fri, 03 Oct 2008 15:09:13 GMT]]></title><description><![CDATA[<p>Das &quot;connect&quot; kommt ja irgendwann selber zurück, und dann muss er halt ein Flag abfragen, welches angibt oder der Thread schon &quot;beendet&quot; wurde... und muss sich eben beenden.</p>
<p>Du kannst auch den Socket &quot;schliessen&quot;, dann sollte das connect auch sofort zurückkommen und dann auf das Flag achten...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593008</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593008</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 03 Oct 2008 15:09:13 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Fri, 03 Oct 2008 19:00:02 GMT]]></title><description><![CDATA[<p>wie schließe ich den socket?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593116</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593116</guid><dc:creator><![CDATA[frageee]]></dc:creator><pubDate>Fri, 03 Oct 2008 19:00:02 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Fri, 03 Oct 2008 19:40:34 GMT]]></title><description><![CDATA[<p>closesocket</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>Any pending blocking, asynchronous calls issued by any thread in this process are canceled without posting any notification messages.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1593132</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593132</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 03 Oct 2008 19:40:34 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Fri, 03 Oct 2008 21:12:24 GMT]]></title><description><![CDATA[<p>aber wenn ich auf Start Server wieder klicke sollte es dann nochmal verbinden und das scheint nicht zu funktionieren nach einem aufruf von closesocket auf die 3 sockets</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593144</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593144</guid><dc:creator><![CDATA[markusxxxx]]></dc:creator><pubDate>Fri, 03 Oct 2008 21:12:24 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Sat, 04 Oct 2008 07:33:10 GMT]]></title><description><![CDATA[<p>Du machst ja ein &quot;bind&quot;!<br />
Ich denke, Du solltest Dein ganzes System überdenken...</p>
<p>Ich würde die ganzen Threads *immer* laufen lassen und nur nach einen Verbindungsversich *vor* einem &quot;accept&quot; prüfen, ob der Server &quot;läuft&quot;. Damit hast Du mit den Threads nie Probleme!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593229</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 04 Oct 2008 07:33:10 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Sat, 04 Oct 2008 08:05:33 GMT]]></title><description><![CDATA[<p>danke! eine gute lösung</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593236</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593236</guid><dc:creator><![CDATA[markusxxxx]]></dc:creator><pubDate>Sat, 04 Oct 2008 08:05:33 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Sun, 05 Oct 2008 17:26:11 GMT]]></title><description><![CDATA[<p>sorry ich muss das nochmal auffassen.<br />
Hier mal mein derzeitiger Code:</p>
<pre><code class="language-cpp">SOCKET connectSocket(unsigned port)
{
	WSADATA wsa;
	SOCKADDR_IN addr;
	SOCKET acceptSocket, connectedSocket;
	if(WSAStartup(MAKEWORD(2,0), &amp;wsa) != 0)
	{
		return SOCKET_ERROR;
	}
	acceptSocket = socket(AF_INET,SOCK_STREAM,0);
	if(acceptSocket==INVALID_SOCKET)
	{
		return SOCKET_ERROR;
	}
	memset(&amp;addr,0,sizeof(SOCKADDR_IN));
	addr.sin_family=AF_INET;
	addr.sin_port=htons(port);
	addr.sin_addr.s_addr=INADDR_ANY;
	if(bind(acceptSocket,(SOCKADDR*)&amp;addr,sizeof(SOCKADDR_IN)) == SOCKET_ERROR)
	{
		return SOCKET_ERROR;
	}
	if(listen(acceptSocket,10)==SOCKET_ERROR)
	{
		return SOCKET_ERROR;
	}
	if(socketoption == TRUE)
	{
		connectedSocket=accept(acceptSocket,NULL,NULL);
		if(connectedSocket==INVALID_SOCKET)
		{
			return SOCKET_ERROR;
		}
		return connectedSocket;
	}
	else
		return 1002;
}

void Thread1 (PVOID pvoid)
{
	while(1)
	{
		s1 = connectSocket(450);
		if(s1 == SOCKET_ERROR)
		{
			SetDlgItemText(FindWindow(0, &quot;&quot;), IDC_BUTTON2, &quot;Start Server&quot;);
			MessageBox(0, &quot;Konnte nicht verbinden!&quot;, szAppName, MB_ICONERROR);
		}
		else if(s1 == 1002)
		   	;
		else
		{
			break;
		}
		Sleep(100);
	}
    _endthread () ;
}

void Thread2 (PVOID pvoid)
{
	while(1)
	{
		s2 = connectSocket(451);
		if(s2 == SOCKET_ERROR)
		{
			SetDlgItemText(FindWindow(0, &quot;&quot;), IDC_BUTTON2, &quot;Start Server&quot;);
			MessageBox(0, &quot;Konnte nicht verbinden!&quot;, szAppName, MB_ICONERROR);
		}
		else if(s2 == 1002)
			;
		else
		{
			break;
		}
		Sleep(100);
	}
    _endthread () ;
}

void Thread3 (PVOID pvoid)
{
	while(1)
	{
		s3 = connectSocket(452);
		if(s3 == SOCKET_ERROR)
		{
			SetDlgItemText(FindWindow(0, &quot;&quot;), IDC_BUTTON2, &quot;Start Server&quot;);
			MessageBox(0, &quot;Konnte nicht verbinden!&quot;, szAppName, MB_ICONERROR);
		}
		else if(s3 == 1002)
			;
		else
		{
			SetDlgItemText(FindWindow(0, &quot;Watch Out&quot;), IDC_BUTTON2, &quot;Connected&quot;);
			break;
		}
		Sleep(100);
	}
    _endthread () ;
}
</code></pre>
<p>Die 3 Threads werden gleich bei Programmstart gestartet.<br />
natürlich ist socketoption aber dann noch FALSE da man noch nicht auf Start Server geklickt hat. und wenn es FALSE ist macht es nichts und geht gleich die schleife nochmal durch. Hierbei kommt natürlich wieder der connect code aber man kann ja nur 1 mal pro port binden. das heißt das es beim 2. durchlauf gar nicht mehr klappen würde. wie würdet ihr das lösen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593791</guid><dc:creator><![CDATA[markusxxxx]]></dc:creator><pubDate>Sun, 05 Oct 2008 17:26:11 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Sun, 05 Oct 2008 17:40:08 GMT]]></title><description><![CDATA[<p>ich hab die abfrage jetzt einfach über den ganzen connectteil gemacht.</p>
<p>Noch ne andere Frage:<br />
Wenn der Client beendet wird, welchen wert hat dann Socket_error damit ich abfragen kann ob es ein fehler war oder ob der client beendet wurde?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593809</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593809</guid><dc:creator><![CDATA[markusxxxx]]></dc:creator><pubDate>Sun, 05 Oct 2008 17:40:08 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Sun, 05 Oct 2008 20:11:07 GMT]]></title><description><![CDATA[<p>psuh</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593877</guid><dc:creator><![CDATA[markusxxxx]]></dc:creator><pubDate>Sun, 05 Oct 2008 20:11:07 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 05:13:00 GMT]]></title><description><![CDATA[<p>Das einfachste ist immer noch in die Doku zu schauen...<br />
z.B. bei &quot;recv&quot;:</p>
<blockquote>
<p>If the socket is connection oriented and the remote side has shut down the connection gracefully, and all data has been received, a recv will complete immediately with zero bytes received. If the connection has been reset, a recv will fail with the error WSAECONNRESET.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1593956</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593956</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 06 Oct 2008 05:13:00 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 15:50:35 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">recvBack = recv(s1, (char *)&amp;length, sizeof(length), 0);
if(recvBack  == WSAECONNRESET) MessageBox(0, &quot;&quot;, &quot;&quot;, 0);
</code></pre>
<p>so funktioniert es jedenfalls nicht. wenn der client geschlossen ist tut sich nix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594324</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Mon, 06 Oct 2008 15:50:35 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 15:58:01 GMT]]></title><description><![CDATA[<p>Dann ist die Frage, wie der Client geschlossen wird...<br />
Aber &quot;recv&quot; kommt schon sofort zurück, oder nicht? Wenn nicht, dann schliess der Client die Verbindung nicht korrekt; stört aber auch nicht, da denn irgendwan der Timeout kommt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594334</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 06 Oct 2008 15:58:01 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 16:16:30 GMT]]></title><description><![CDATA[<p>server:</p>
<pre><code class="language-cpp">recvBack = recv(s1, (char *)&amp;length, sizeof(length), 0);
		if(recvBack  == WSAECONNRESET)
		{
			MessageBox(0, &quot;Client has been closed!&quot;, szAppName, 0); 
			SendMessage(FindWindow(0, &quot;progname&quot;), WM_COMMAND, IDCANCEL, 0); 
		}
</code></pre>
<p>client:</p>
<pre><code class="language-cpp">case WM_DESTROY:
		  closesocket(s);
		  WSACleanup();
          PostQuitMessage (0) ;
          return 0 ;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1594347</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594347</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Mon, 06 Oct 2008 16:16:30 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 16:35:52 GMT]]></title><description><![CDATA[<p>markusxxx schrieb:</p>
<blockquote>
<pre><code class="language-cpp">recvBack = recv(s1, (char *)&amp;length, sizeof(length), 0);
		if(recvBack  == WSAECONNRESET)
</code></pre>
</blockquote>
<p>Ähh... Du hast aber schon die Doku zu &quot;recv&quot; gelesen, oder???</p>
<p>Falls nicht, dann hol das mal schleunigst nach!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594360</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 06 Oct 2008 16:35:52 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 19:22:37 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">recvBack = recv(s1, (char *)&amp;length, sizeof(length), 0);
		if(recvBack == SOCKET_ERROR &amp;&amp; GetLastError() == WSAECONNRESET)
		{
			MessageBox(0, &quot;Client has been closed!&quot;, szAppName, 0); 
			SendMessage(FindWindow(0, &quot;progname&quot;), WM_COMMAND, IDCANCEL, 0); 
		}
</code></pre>
<p>funktioniert nicht <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1594444</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594444</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Mon, 06 Oct 2008 19:22:37 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 19:27:21 GMT]]></title><description><![CDATA[<p>MSDN schrieb:</p>
<blockquote>
<p>If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is <strong>zero</strong>. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1594445</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594445</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Mon, 06 Oct 2008 19:27:21 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 19:37:38 GMT]]></title><description><![CDATA[<p>hm jeder sagt was anderes. Soll ich jetzt 0 oder den Error code von Jochen abfragen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594451</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594451</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Mon, 06 Oct 2008 19:37:38 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Mon, 06 Oct 2008 20:32:29 GMT]]></title><description><![CDATA[<p>heul langsam nervts nichts klappt -.-</p>
<pre><code class="language-cpp">recvBack = recv(s1, (char *)&amp;length, sizeof(length), 0);
		if(recvBack == 0)
		{
			MessageBox(0, &quot;Client has been closed!&quot;, szAppName, 0); 
			SendMessage(FindWindow(0, &quot;name&quot;), WM_COMMAND, IDCANCEL, 0); 
		}
</code></pre>
<p>geht natürlich auch nicht. Es scheint so als würde recv die kontrolle nicht mehr zurückgeben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594480</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594480</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Mon, 06 Oct 2008 20:32:29 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Tue, 07 Oct 2008 15:33:40 GMT]]></title><description><![CDATA[<p>hat keiner eine Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594923</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Tue, 07 Oct 2008 15:33:40 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Tue, 07 Oct 2008 15:45:10 GMT]]></title><description><![CDATA[<blockquote>
<p>geht natürlich auch nicht. Es scheint so als würde recv die kontrolle nicht mehr zurückgeben</p>
</blockquote>
<p>Ja, recv ist blockierend. Lies die MSDN.<br />
Simon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594929</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594929</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Tue, 07 Oct 2008 15:45:10 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Tue, 07 Oct 2008 16:11:41 GMT]]></title><description><![CDATA[<p>du weißt leider nicht mal um was es überhaupt geht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594952</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Tue, 07 Oct 2008 16:11:41 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Tue, 07 Oct 2008 16:19:03 GMT]]></title><description><![CDATA[<p>markusxxx schrieb:</p>
<blockquote>
<p>hm jeder sagt was anderes. Soll ich jetzt 0 oder den Error code von Jochen abfragen?</p>
</blockquote>
<p>Beides. Wenn recv 0 zurückgibt, dann wurde die Verbindung &quot;normal&quot; geschlossen, bei SOCKET_ERROR ist ein Fehler aufgetreten, den du mit WSAGetLastError ermittelst. edit: Und du bist dir auch sicher, dass closesocket auch aufgerufen wird?</p>
<p>theta schrieb:</p>
<blockquote>
<p>recv ist blockierend.</p>
</blockquote>
<p>Je nach dem, ob der Socket blockierend ist, oder nicht? Wenn der Socket nicht blockierend ist und keine Daten vorliegen, müsste recv mit SOCKET_ERROR und WSAGetLastError()==WSAEWOULDBLOCK zurückkommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594957</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Tue, 07 Oct 2008 16:19:03 GMT</pubDate></item><item><title><![CDATA[Reply to einen mit beginthread begonnen thread schließen on Tue, 07 Oct 2008 16:23:13 GMT]]></title><description><![CDATA[<p>hier nochma der Code:</p>
<pre><code class="language-cpp">server:
C/C++ Code:
        recvBack = recv(s1, (char *)&amp;length, sizeof(length), 0);
        if(recvBack  == 0)
        {
            MessageBox(0, &quot;Client has been closed!&quot;, szAppName, 0);
            SendMessage(FindWindow(0, &quot;progname&quot;), WM_COMMAND, IDCANCEL, 0);}
Client
     case WM_DESTROY:
          closesocket(s);
          WSACleanup();
          PostQuitMessage (0) ;
          return 0 ;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1594960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594960</guid><dc:creator><![CDATA[markusxxx]]></dc:creator><pubDate>Tue, 07 Oct 2008 16:23:13 GMT</pubDate></item></channel></rss>