RE: Missing error in WSAAsyncSelect event completion in x64 environmen

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Timothy,
I understand that your 32 bit application could not work fine under your
Windows Server 2003 x64 due to not catching FD_CONNECT event since the
HIWORD of LPARAM was always 0.
If I have misunderstood, please let me know.

I performed a test at my side (Windows Server 2003 Ent x64), however I
could not reproduce your issue. I would like to share with you my code
snippets here:
======================================================
void CMFCSockClientDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
WORD sockVersion;
WSAData sockData;
int err;
sockVersion = MAKEWORD(2,2);
char serverName[20];
err = WSAStartup(sockVersion,&sockData);
if(0!=err){
MessageBox("Socket startup error with error code %d\n");
}

SOCKET cs=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
sockaddr_in saServer;
hostent* server;

txtServerName.GetDlgItemText(IDC_ServerName,serverName,20);
server = gethostbyname(serverName);


saServer.sin_family = AF_INET;
saServer.sin_port = htons(5150);
saServer.sin_addr.s_addr = inet_addr(inet_ntoa (*(struct in_addr
*)*server->h_addr_list));
err = WSAAsyncSelect(cs,this->m_hWnd,WM_SOCKET,FD_CONNECT);

err = WSAConnect(cs, (sockaddr
*)&saServer,sizeof(saServer),NULL,NULL,NULL,NULL);
if(err == SOCKET_ERROR)
{
int n = WSAGetLastError();
CString s;
s.Format("%d",n);
MessageBox(s.GetBuffer(0));

}

Sleep(2000);
closesocket(cs);
WSACleanup();

}


LRESULT CMFCSockClientDlg::WindowProc(UINT message, WPARAM wParam, LPARAM
lParam)
{
int nErr;
switch(message)
{
case WM_SOCKET:
if (nErr = WSAGETSELECTERROR(lParam)) {
CString s;
s.Format("%d",nErr);
MessageBox(s.GetBuffer(0));
}
if(WSAGETSELECTEVENT(lParam)==FD_CONNECT) {
MessageBox("FD_CONNECT");
}
break;
default:
break;
}

return CDialog::WindowProc(message,wParam,lParam);
}
====================================================================

I recommend that you check if there are some things omitted in your code or
that you test if my code can work at your side.
Please also let me know the result.

If you have any other questions or concerns, please feel free to let me
know. It is my pleasure to be of assistance.

Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications

If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.


Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================






.



Relevant Pages

  • Re: Can SSAS 2005 work in Novell network?
    ... windows account which was used to log on to the local machine. ... the server to the relevant OLAP roles you should be good to go. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sqlserver.olap)
  • Re: C2872 IServiceProvider ambiguous symbol - migrating C++/MFC App with /clr to Visual Studio 2
    ... Infinite thanks for yet another excellent response. ... "typedef interface IServiceProvider IServiceProvider;" ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Intermittent work in UI thread
    ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vc.mfc)
  • RE: Non-negative number required. Parameter name: byteCount
    ... Is your ASP.NET server service built on ASP.NET 1.1 or 2.0? ... The problem however is that the content (or error message) returned from ... InvalidOperationException with the message text of client found response ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Intermittent work in UI thread
    ... then the issue here is that you would have a timer handler something like ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vc.mfc)