<?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[Socket Problem]]></title><description><![CDATA[<p>Hallo Zusammen,<br />
habe versucht ein kleines Client-Server Programm zu schreiben, habe aber bei dem Server das Problem, dass er sich bei dem Befehl accept() aufhängt. Woran kann das liegen?<br />
Gruß mr.tompkins</p>
<pre><code class="language-cpp">SOCKET serverSocket;
SOCKADDR_IN addr;

serverSocket=socket(AF_INET,SOCK_STREAM,0);

memset(&amp;addr,0,sizeof(SOCKADDR_IN));
addr.sin_family=AF_INET;
addr.sin_port=htons(5000);
addr.sin_addr.s_addr=ADDR_ANY;

bind(serverSocket,(SOCKADDR*)&amp;addr,sizeof(SOCKADDR_IN));

listen(serverSocket,10);

SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- Port 5000 geöffnet&quot;);	

accept(serverSocket,NULL,NULL);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/175829/socket-problem</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 19:19:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/175829.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Mar 2007 14:23:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Socket Problem on Wed, 14 Mar 2007 14:23:09 GMT]]></title><description><![CDATA[<p>Hallo Zusammen,<br />
habe versucht ein kleines Client-Server Programm zu schreiben, habe aber bei dem Server das Problem, dass er sich bei dem Befehl accept() aufhängt. Woran kann das liegen?<br />
Gruß mr.tompkins</p>
<pre><code class="language-cpp">SOCKET serverSocket;
SOCKADDR_IN addr;

serverSocket=socket(AF_INET,SOCK_STREAM,0);

memset(&amp;addr,0,sizeof(SOCKADDR_IN));
addr.sin_family=AF_INET;
addr.sin_port=htons(5000);
addr.sin_addr.s_addr=ADDR_ANY;

bind(serverSocket,(SOCKADDR*)&amp;addr,sizeof(SOCKADDR_IN));

listen(serverSocket,10);

SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- Port 5000 geöffnet&quot;);	

accept(serverSocket,NULL,NULL);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1245479</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1245479</guid><dc:creator><![CDATA[mr.tompkins]]></dc:creator><pubDate>Wed, 14 Mar 2007 14:23:09 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Wed, 14 Mar 2007 16:05:16 GMT]]></title><description><![CDATA[<p>Hm prüf mal die Return-Werte... des weiteren kannst Du den Verlauf (und die Variableninhalte) auch mal im Debugger prüfen.</p>
<p>PS: Das:</p>
<p>mr.tompkins schrieb:</p>
<blockquote>
<pre><code class="language-cpp">SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- Port 5000 geöffnet&quot;);
</code></pre>
</blockquote>
<p>kann sehr böse enden, wenn Du Unicode definiert hast. Sollte wohl eher so aussehen:</p>
<pre><code class="language-cpp">SendMessage(hwndLA, LB_ADDSTRING, 0, reinterpret_cast&lt;LONG_PTR&gt;(TEXT(&quot;- Port 5000 geöffnet&quot;)));
</code></pre>
<p>Wobei Du statt des C++ Casts auch den 'äquivalenten' C-Cast <em>(Type)</em> verwenden kannst <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/1245582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1245582</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 14 Mar 2007 16:05:16 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Wed, 14 Mar 2007 16:46:18 GMT]]></title><description><![CDATA[<p>Danke für die schnelle Hilfe.<br />
Habe das Problem schon gelöst indem ich die accept Anweisung in die Nachrichtenschleife geschrieben habe.<br />
Habe aber jetzt ein anderes Problem:<br />
Ich versuche mit</p>
<pre><code class="language-cpp">send(connectSocket,buf,20,0);
</code></pre>
<p>einen String zu senden und mit</p>
<pre><code class="language-cpp">recv(serverSocket,buf,256,0);
</code></pre>
<p>auszulesen. Als Ausgabe bekomme aber nur eine leere Zeile.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1245622</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1245622</guid><dc:creator><![CDATA[mr.tompkins]]></dc:creator><pubDate>Wed, 14 Mar 2007 16:46:18 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sun, 18 Mar 2007 13:36:11 GMT]]></title><description><![CDATA[<p>Also um etwas genaur zu werden:<br />
Ich habe ersucht mit</p>
<pre><code class="language-cpp">send(connectSocket,&quot;Test&quot;,4,0);
</code></pre>
<p>etwas zu senden und mit</p>
<pre><code class="language-cpp">case WM_SOCKET:
  switch(WSAGETSELECTEVENT(lParam))
     {
	case FD_READ:
	  rlen=recv(serverSocket,readbuff,20,0);
           break;

         case FD_ACCEPT:
           accept(serverSocket,NULL,NULL); 
           break;
</code></pre>
<p>zu empfangen. Muss ich recv über eine Schleie laufen lassen?<br />
Er empfängt aufjeden Fall nur leere Zeichen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1247691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1247691</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Sun, 18 Mar 2007 13:36:11 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sun, 18 Mar 2007 17:15:53 GMT]]></title><description><![CDATA[<p>Vielleicht ist ja irgendwo anders der Fehler.</p>
<pre><code class="language-cpp">#include &lt;winsock2.h&gt;
#include &lt;windows.h&gt;
#include &quot;resource.h&quot;
#include &lt;stdio.h&gt;

const char g_szClassName[] = &quot;neueFensterKlasse&quot;;

HWND hwnd;
HWND hwndBA, hwndLA, hwndLB, hwndLC;

SOCKET listen_socket;
SOCKET serverSocket, connectedSocket;
long rc;

void initwinsock()
{

WSADATA wsa;
rc=WSAStartup(MAKEWORD(2,0),&amp;wsa);
if(rc==0)
SendMessage(hwndLA, LB_DELETESTRING, 0, 0);
SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- Socket gestartet&quot;);

}

void winsocklisten()
{

SOCKADDR_IN addr;

serverSocket=socket(AF_INET,SOCK_STREAM,0);

memset(&amp;addr,0,sizeof(SOCKADDR_IN));
addr.sin_family=AF_INET;
addr.sin_port=htons(5000);
addr.sin_addr.s_addr=ADDR_ANY;

bind(serverSocket,(SOCKADDR*)&amp;addr,sizeof(SOCKADDR_IN));

WSAAsyncSelect(serverSocket,hwnd,WM_SOCKET,FD_READ|FD_CLOSE|FD_ACCEPT);

listen(serverSocket,10);

SendMessage(hwndLA, LB_DELETESTRING, 0, 0);
SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- Port 5000 geöffnet&quot;);	

}

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{

	char readbuff[20];
	int  rlen;

    switch(Message)
    {

        case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                case ID_EXIT:
                DestroyWindow(hwnd);
                break;
                case ID_INFO:
                MessageBox(hwnd,&quot;Chat-Server v1.0&quot;,&quot;Info&quot;,MB_OK);
                break;
            }
        break;

	case WM_CLOSE:
            DestroyWindow(hwnd);
        break;

	case WM_DESTROY:
            PostQuitMessage(0);
        break;

    case WM_SOCKET:

		 switch(WSAGETSELECTEVENT(lParam))
			{
			case FD_READ:
				rlen=recv(serverSocket,readbuff,20,0);		
				SendMessage(hwndLB, LB_INSERTSTRING, 0, (long)readbuff);
				return 0;
			case FD_ACCEPT:
				accept(serverSocket,NULL,NULL); 
				SendMessage(hwndLA, LB_DELETESTRING, 0, 0);
				SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- verbunden...&quot;);
				return 0;
			case FD_CLOSE:
				SendMessage(hwndLA, LB_DELETESTRING, 0, 0);
				SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- Verbindung abgebrochen&quot;);
				return 0;
			} 
	default:
            return DefWindowProc(hwnd, Message, wParam, lParam);
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX wc;

    MSG Msg;

    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));
    wc.hIconSm       = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 50, 0);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = CreateSolidBrush(RGB(239,235,222));
    wc.lpszClassName = g_szClassName;
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MYMENU);

    if(!RegisterClassEx(&amp;wc))
    {
        MessageBox(NULL, &quot;Window Registration Failed!&quot;, &quot;Error!&quot;,
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        g_szClassName,
        &quot;Chat-Server&quot;,
        WS_OVERLAPPEDWINDOW^WS_MAXIMIZEBOX,
        500, 50,    //position	
	250, 400,   //größe
        NULL, NULL, hInstance, NULL);

    hwndLA = CreateWindowEx(WS_EX_CLIENTEDGE,&quot;LISTBOX&quot;, 0,WS_CHILD | WS_VISIBLE,
                                  20, 20, 200, 30, hwnd, NULL, hInstance, NULL) ;

    hwndLB = CreateWindowEx(WS_EX_CLIENTEDGE,&quot;LISTBOX&quot;, 0,WS_CHILD | WS_VISIBLE ,
                                  20, 50, 200, 120, hwnd, NULL, hInstance, NULL) ;

    hwndLC = CreateWindowEx(WS_EX_CLIENTEDGE,&quot;LISTBOX&quot;, 0,WS_CHILD | WS_VISIBLE,
                                  20, 250, 200, 30, hwnd, NULL, hInstance, NULL);    

    hwndBA = CreateWindow(&quot;BUTTON&quot;, &quot;Senden&quot;,WS_CHILD | WS_VISIBLE | BS_CENTER|BS_VCENTER,
                                  60, 300, 100, 30, hwnd, NULL, hInstance, NULL) ;

    SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- nicht verbunden...&quot;);

    if(hwnd == NULL)
    {
        MessageBox(NULL, &quot;Window Creation Failed!&quot;, &quot;Error!&quot;,
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

	initwinsock();
    winsocklisten();

    while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
    {
        TranslateMessage(&amp;Msg);
        DispatchMessage(&amp;Msg);
    }
    return Msg.wParam;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1247867</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1247867</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Sun, 18 Mar 2007 17:15:53 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sun, 18 Mar 2007 17:40:29 GMT]]></title><description><![CDATA[<p>Unbedingt recv()-Rückgabewert prüfen!<br />
Ansonsten lies hier auch mal ein wenig rum - Bei recv() musst du beim len-Parameter ein wenig aufpassen:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-175032-and-postdays-is-0-and-postorder-is-asc-and-start-is-0.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-175032-and-postdays-is-0-and-postorder-is-asc-and-start-is-0.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1247881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1247881</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sun, 18 Mar 2007 17:40:29 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Mon, 19 Mar 2007 07:45:17 GMT]]></title><description><![CDATA[<p>Habe den Rückgabewert von recv() geprüft. Gibt immer -1 zurück.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1248130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1248130</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Mon, 19 Mar 2007 07:45:17 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Mon, 19 Mar 2007 10:49:41 GMT]]></title><description><![CDATA[<p>Kann es vielleicht auch sein, dass der Socket falsch initialisiert ist oder mit der Nachrichten verarbeitung etwas nicht stimmt?<br />
Spielt es eine Rolle wie ich WM_SOCKET definiere<br />
(#define WM_SOCKET (WM_USER+1)?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1248262</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1248262</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Mon, 19 Mar 2007 10:49:41 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Mon, 19 Mar 2007 13:34:59 GMT]]></title><description><![CDATA[<p>WSAAsyncSelect() macht den Socket asynchron, d.h. recv() blockiert nicht mehr!</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>The WSAAsyncSelect function automatically sets socket s to nonblocking mode, regardless of the value of lEvent.</p>
</blockquote>
<p>Ich wette -1 entspricht dem in der MSDN angegebenen SOCKET_ERROR und WSAGetlastError() wird die dann noch WSAEWOULDBLOCK zurückliefern.</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.</p>
</blockquote>
<p>Lies mal ein wenig in der msdn rum <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=";D"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1248376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1248376</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Mon, 19 Mar 2007 13:34:59 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Thu, 22 Mar 2007 18:47:23 GMT]]></title><description><![CDATA[<p>Werde da irgendwie nicht schlau draus<br />
Habe mal recv() weggelassen und nur eine MessageBox bei FD_READ eingetragen. Die kommt aber nur einmal, eim nächsten senden bzw. empfangen tut sich gar nichts mehr.<br />
Woher weiß ich mit welcher Version ich den Socket initialisieren muss (WSAStartup)?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1250743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1250743</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Thu, 22 Mar 2007 18:47:23 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Fri, 23 Mar 2007 01:38:14 GMT]]></title><description><![CDATA[<p>Nimm immer Winsock 2.0 (für win95 gibts dafür nen update, bei allen folgenden Windows-Versionen ist es vorinstalliert)</p>
<p>Du kriegst keine weiteren Events, weil du nur beim Server-Socket WSAAsyncSelect() benutzt. Die Sockets zu den Clients bekommst du als Rückgabewert von accept() den du zur Zeit quasi im Nirvana verschwinden lässt, auf diesen müsstest du allerdings auch WSAASyncSelect() anwenden <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=";D"
      alt="😉"
    /></p>
<p>Den Socket für den die Notfication kommt steht im wParam von WM_SOCKET...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1250891</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1250891</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Fri, 23 Mar 2007 01:38:14 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Fri, 23 Mar 2007 11:42:07 GMT]]></title><description><![CDATA[<p>OK, habe folgendes probiert:</p>
<pre><code class="language-cpp">case WM_SOCKET_NOTIFY:
		SOCKET Socket,clientSocket;	
		Socket=(SOCKET)(wParam);

		 switch(LOWORD(lParam))
			{
			case FD_READ:
			    //lesen();
				MessageBox(hwnd,&quot;Nachricht vom Client&quot;,&quot;&quot;,MB_OK);
				return 0;
			case FD_ACCEPT:
				struct sockaddr clientIn;
				int clientLen;
				clientLen = sizeof(clientIn);
				clientSocket=accept(Socket,(struct sockaddr*)&amp;clientIn,&amp;clientLen); 
				WSAAsyncSelect(clientSocket,hwnd,WM_SOCKET_NOTIFY,FD_READ|FD_CLOSE|FD_ACCEPT);

				SendMessage(hwndLA, LB_DELETESTRING, 0, 0);
				SendMessage(hwndLA, LB_ADDSTRING, 0, (long)&quot;- verbunden...&quot;);
				return 0;
</code></pre>
<p>hat aber auch nicht funktioniert, es kommt immer nur einmal die MessageBox. Wenn ich den Client beende und wieder aufrufe funktioniert es wieder, aber wieder nur einmal.</p>
<p>Kann das Problem auch bei Client liegen:</p>
<pre><code class="language-cpp">...
connectSocket=socket(AF_INET,SOCK_STREAM,0);

memset(&amp;addr,0,sizeof(SOCKADDR_IN));
addr.sin_family=AF_INET;
addr.sin_port=htons(5000);
addr.sin_addr.s_addr=inet_addr(&quot;127.0.0.1&quot;);

WSAAsyncSelect(connectSocket,hwnd,WM_SOCKET,FD_READ|FD_CLOSE|FD_CONNECT);

connect(connectSocket,(struct sockaddr*)&amp;addr,sizeof(addr));

...
	case ID_SEND:
				    char buf[20];
				    buf[0]='-';

				    GetWindowText(hwndLC,buf,20);

			    	 if(send(connectSocket,buf,20,0)==20){
				       SendMessage(hwndLB,LB_INSERTSTRING, 0,(long)buf);
                       SetWindowText(hwndLC,0);
					 }

				    break;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1251065</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1251065</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Fri, 23 Mar 2007 11:42:07 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Fri, 23 Mar 2007 13:17:53 GMT]]></title><description><![CDATA[<p>Holst du auch bei jedem FD_READ sämtliche Daten (via recv z.B.) aus dem Empfangsbuffer? Weitere FD_READ-Nachrichten für denselben Socket werden von Winsock unterdrückt solange die Daten für das erste FD_READ nicht vollständig aus dem Empfangsbuffer geholt worden sind...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1251124</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1251124</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Fri, 23 Mar 2007 13:17:53 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Fri, 23 Mar 2007 18:05:12 GMT]]></title><description><![CDATA[<p>Bin begeistert, es funktioniert.<br />
Vielen Dank für die Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1251324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1251324</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Fri, 23 Mar 2007 18:05:12 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sat, 24 Mar 2007 14:31:31 GMT]]></title><description><![CDATA[<p>geeky schrieb:</p>
<blockquote>
<p>Holst du auch bei jedem FD_READ sämtliche Daten (via recv z.B.) aus dem Empfangsbuffer? Weitere FD_READ-Nachrichten für denselben Socket werden von Winsock unterdrückt solange die Daten für das erste FD_READ nicht vollständig aus dem Empfangsbuffer geholt worden sind...</p>
</blockquote>
<blockquote>
<p>A single recv in response to each FD_READ message is appropriate.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1251650</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1251650</guid><dc:creator><![CDATA[...........]]></dc:creator><pubDate>Sat, 24 Mar 2007 14:31:31 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sat, 24 Mar 2007 22:28:10 GMT]]></title><description><![CDATA[<p>Ok, da hat mich mein Gedächtnis wohl verarscht <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=";D"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1251946</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1251946</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 24 Mar 2007 22:28:10 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Fri, 06 Apr 2007 13:19:53 GMT]]></title><description><![CDATA[<p>Hätte noch ein anderes Problem.<br />
Wenn ich den Client starte zeigt er mir an, dass ich verbunden bin obwohl noch kein Server existiert. Das heißt wohl er bekomt ein FD_CONNECT ohne verbunden zu sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1260612</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1260612</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Fri, 06 Apr 2007 13:19:53 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sun, 08 Apr 2007 08:49:34 GMT]]></title><description><![CDATA[<p>Gibt es ein anderes Socket-Evenet, mit dem ich abfragen kann ob ein Server vorhanden ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1261514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1261514</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Sun, 08 Apr 2007 08:49:34 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sun, 08 Apr 2007 19:57:44 GMT]]></title><description><![CDATA[<p>wenn der connect fehlschlägt, also kein server da ist bzw. keiner gefunden, gibt es als return code &quot;SOCKET_ERROR&quot;.</p>
<p>das problem liegt wohl an deinem programm, das du irgendwo etwas falsch ausgibts. wenn der server nicht da ist, kann sich der socket nicht dahin connecten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1261907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1261907</guid><dc:creator><![CDATA[afass]]></dc:creator><pubDate>Sun, 08 Apr 2007 19:57:44 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sun, 08 Apr 2007 20:44:57 GMT]]></title><description><![CDATA[<p>Wenn kein Server vorhanden ist bekomme ich auch SOCKET_ERROR aber anschließend trotzdem FD_CONNENCT. Was könnte falsch sein?</p>
<pre><code class="language-cpp">...
	WSADATA wsa;
	rc=WSAStartup(MAKEWORD(2,0),&amp;wsa);

...

	clientSocket=socket(AF_INET,SOCK_STREAM,0);

	WSAAsyncSelect(clientSocket,hwnd,WM_SOCKET_NOTIFY,FD_READ|FD_CLOSE|FD_CONNECT);

	memset(&amp;addr,0,sizeof(SOCKADDR_IN));
	addr.sin_family=AF_INET;
	addr.sin_port=htons(port);
	addr.sin_addr.s_addr=inet_addr(ip);

	rc = connect(clientSocket,(struct sockaddr*)&amp;addr,sizeof(addr));

	if( rc == SOCKET_ERROR)
	{

		SendMessage(hwndLA, LB_DELETESTRING, 0, 0);
		SendMessage(hwndLA, LB_ADDSTRING, 0, reinterpret_cast&lt;LPARAM&gt;(TEXT(&quot;- connect Fehler&quot;)));	
		return;	
	}

...

    case WM_SOCKET_NOTIFY:

		switch(LOWORD(lParam))
			{
...

			case FD_CONNECT:
				SendMessage(hwndLA, LB_ADDSTRING, 0, reinterpret_cast&lt;LPARAM&gt;(TEXT(&quot;- Verbunden&quot;)));

				return 0;

...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1261939</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1261939</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Sun, 08 Apr 2007 20:44:57 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Sun, 08 Apr 2007 23:21:40 GMT]]></title><description><![CDATA[<p>Dann prüf doch auf Fehler mit dem Makro WSAGETSELECTERROR auf lParam.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1262022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1262022</guid><dc:creator><![CDATA[()]]></dc:creator><pubDate>Sun, 08 Apr 2007 23:21:40 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Mon, 09 Apr 2007 16:59:03 GMT]]></title><description><![CDATA[<p>WSAGetLastError liefert: WSAEWOULDBLOCK</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1262405</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1262405</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Mon, 09 Apr 2007 16:59:03 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Mon, 09 Apr 2007 17:23:31 GMT]]></title><description><![CDATA[<p>lern mal lesen junge</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1262428</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1262428</guid><dc:creator><![CDATA[()]]></dc:creator><pubDate>Mon, 09 Apr 2007 17:23:31 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Mon, 09 Apr 2007 17:29:29 GMT]]></title><description><![CDATA[<p>Sorry für meine Ausdrucksweise. Wenn du FD_CONNECT bekommst kannst du nicht mehr WSAGetLastError benutzen sondern der Error-Code befindet sich dann in lParam und kann mit WSAGET<strong>SELECT</strong>ERROR extrahiert werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1262431</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1262431</guid><dc:creator><![CDATA[()]]></dc:creator><pubDate>Mon, 09 Apr 2007 17:29:29 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Tue, 10 Apr 2007 08:47:08 GMT]]></title><description><![CDATA[<p>Ich dachte das käme aufs gleiche raus.<br />
WSAGETSELECTERROR(lParam) liefert : WSAECONNREFUSED</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1262708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1262708</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Tue, 10 Apr 2007 08:47:08 GMT</pubDate></item><item><title><![CDATA[Reply to Socket Problem on Tue, 10 Apr 2007 08:52:36 GMT]]></title><description><![CDATA[<p>Ok, Problem gelöst vielen Dank für die Hilfe.<br />
Trotzdem komisch, dass der Client FD_CONNECT gepostet bekommt obwohl WSAGETSELECTERROR WSAECONNREFUSED liefert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1262714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1262714</guid><dc:creator><![CDATA[mr. tompkins]]></dc:creator><pubDate>Tue, 10 Apr 2007 08:52:36 GMT</pubDate></item></channel></rss>