<?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[WSAEWOULDBLOCK bei connect]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bekomm von meinem connect immer -1 zurück und</p>
<p>iError = WSAGetLastError();</p>
<p>liefert 10038 = WSAEWOULDBLOCK...<br />
Was kann man da machen?!? Ist ein einfacher HTTP Server auf Port 8080 zu dem ich mich connecten will...</p>
<p>Hier der ganze code:</p>
<pre><code class="language-cpp">int WSASetup(HWND hWnd)
{
	WSAStartup(MAKEWORD(2,0),&amp;wsa);
	s = socket(AF_INET,SOCK_STREAM,0);

	//int iError;	
	if(SOCKET_ERROR == WSAAsyncSelect(s,hWnd,WM_SOCKET_NOTIFY,FD_READ))
	{
		closesocket(s);
		WSACleanup();
		return WSA_ERROR;
	}
	return WSA_OK;
}

BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	int				iError;
	struct hostent*	dnsip;

     switch (message)
     {
	case WM_INITDIALOG:
		//*** WSA Connect ***//
		if (WSASetup(hDlg) == WSA_ERROR)
			return 0;

		memset(&amp;srv, 0, sizeof(SOCKADDR_IN));
		if (inet_addr(ip_address) == INADDR_NONE)
		{
			dnsip = gethostbyname(ip_address);
			if (dnsip)
				memcpy(&amp;srv.sin_addr, dnsip-&gt;h_addr_list[0], sizeof(dnsip));
			else
				return 0;
		}
		else
		{
			srv.sin_addr.s_addr = inet_addr(ip_address);
		}
		srv.sin_port = htons(port);
		srv.sin_family = AF_INET;

		SetTimer (hDlg, ID_TIMER_CONNECT, 1200, 0);
		break;

		return TRUE;
     case WM_COMMAND:
          switch (LOWORD (wParam))
		{
		case IDCANCEL:
		case IDOK:
			closesocket(s);
			WSACleanup();
			//Schluss mit dem Leben :(
			EndDialog (hDlg, 0);
               return TRUE;
          }
          break;
	case WM_TIMER:
		iError = connect(s,(struct sockaddr*) &amp;srv, sizeof(srv));

		if (iError != 0)
		{
			iError = WSAGetLastError();
			SetWindowText(GetDlgItem (hDlg, IDC_INFO), &quot;OFFLINE&quot;);
		}
		else
		{
			SetWindowText(GetDlgItem (hDlg, IDC_INFO), &quot;online&quot;);
		}
		closesocket(s);
		WSACleanup();
		WSASetup(hDlg);
		break;
     }
     return FALSE ;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/71841/wsaewouldblock-bei-connect</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 20:21:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/71841.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Apr 2004 11:06:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WSAEWOULDBLOCK bei connect on Thu, 22 Apr 2004 11:06:30 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bekomm von meinem connect immer -1 zurück und</p>
<p>iError = WSAGetLastError();</p>
<p>liefert 10038 = WSAEWOULDBLOCK...<br />
Was kann man da machen?!? Ist ein einfacher HTTP Server auf Port 8080 zu dem ich mich connecten will...</p>
<p>Hier der ganze code:</p>
<pre><code class="language-cpp">int WSASetup(HWND hWnd)
{
	WSAStartup(MAKEWORD(2,0),&amp;wsa);
	s = socket(AF_INET,SOCK_STREAM,0);

	//int iError;	
	if(SOCKET_ERROR == WSAAsyncSelect(s,hWnd,WM_SOCKET_NOTIFY,FD_READ))
	{
		closesocket(s);
		WSACleanup();
		return WSA_ERROR;
	}
	return WSA_OK;
}

BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	int				iError;
	struct hostent*	dnsip;

     switch (message)
     {
	case WM_INITDIALOG:
		//*** WSA Connect ***//
		if (WSASetup(hDlg) == WSA_ERROR)
			return 0;

		memset(&amp;srv, 0, sizeof(SOCKADDR_IN));
		if (inet_addr(ip_address) == INADDR_NONE)
		{
			dnsip = gethostbyname(ip_address);
			if (dnsip)
				memcpy(&amp;srv.sin_addr, dnsip-&gt;h_addr_list[0], sizeof(dnsip));
			else
				return 0;
		}
		else
		{
			srv.sin_addr.s_addr = inet_addr(ip_address);
		}
		srv.sin_port = htons(port);
		srv.sin_family = AF_INET;

		SetTimer (hDlg, ID_TIMER_CONNECT, 1200, 0);
		break;

		return TRUE;
     case WM_COMMAND:
          switch (LOWORD (wParam))
		{
		case IDCANCEL:
		case IDOK:
			closesocket(s);
			WSACleanup();
			//Schluss mit dem Leben :(
			EndDialog (hDlg, 0);
               return TRUE;
          }
          break;
	case WM_TIMER:
		iError = connect(s,(struct sockaddr*) &amp;srv, sizeof(srv));

		if (iError != 0)
		{
			iError = WSAGetLastError();
			SetWindowText(GetDlgItem (hDlg, IDC_INFO), &quot;OFFLINE&quot;);
		}
		else
		{
			SetWindowText(GetDlgItem (hDlg, IDC_INFO), &quot;online&quot;);
		}
		closesocket(s);
		WSACleanup();
		WSASetup(hDlg);
		break;
     }
     return FALSE ;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/506682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/506682</guid><dc:creator><![CDATA[Der_Knob]]></dc:creator><pubDate>Thu, 22 Apr 2004 11:06:30 GMT</pubDate></item><item><title><![CDATA[Reply to WSAEWOULDBLOCK bei connect on Thu, 22 Apr 2004 12:00:55 GMT]]></title><description><![CDATA[<p>ok... lag an der zeile:</p>
<p>if(SOCKET_ERROR == WSAAsyncSelect(s,hWnd,WM_SOCKET_NOTIFY,FD_READ))</p>
]]></description><link>https://www.c-plusplus.net/forum/post/506718</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/506718</guid><dc:creator><![CDATA[Der_Knob]]></dc:creator><pubDate>Thu, 22 Apr 2004 12:00:55 GMT</pubDate></item><item><title><![CDATA[Reply to WSAEWOULDBLOCK bei connect on Thu, 22 Apr 2004 12:04:28 GMT]]></title><description><![CDATA[<p>Noch als Anmerkung:</p>
<blockquote>
<p>If the application is using WSAAsyncSelect to indicate interest in connection events, then the application will receive an FD_CONNECT notification indicating that the connect operation is complete (successfully or not).<br />
[...]<br />
WSAEWOULDBLOCK - The socket is marked as nonblocking and the connection cannot be completed immediately.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/506721</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/506721</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Thu, 22 Apr 2004 12:04:28 GMT</pubDate></item></channel></rss>