RE: Missing error in WSAAsyncSelect event completion in x64 environmen
- From: changliw@xxxxxxxxxxxxxxxxxxxx (Charles Wang[MSFT])
- Date: Tue, 31 Jul 2007 10:39:36 GMT
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.
======================================================
.
- Follow-Ups:
- RE: Missing error in WSAAsyncSelect event completion in x64 enviro
- From: Timothy Jewett
- RE: Missing error in WSAAsyncSelect event completion in x64 enviro
- Prev by Date: Re: How to Checking a URL :Valid or Invalid
- Next by Date: RE: Missing error in WSAAsyncSelect event completion in x64 environmen
- Previous by thread: TCP performance problems with small data segments
- Next by thread: RE: Missing error in WSAAsyncSelect event completion in x64 enviro
- Index(es):
Relevant Pages
|