RE: Missing error in WSAAsyncSelect event completion in x64 enviro
- From: changliw@xxxxxxxxxxxxxxxxxxxx (Charles Wang[MSFT])
- Date: Wed, 01 Aug 2007 08:19:22 GMT
Hi Timothy,
I am not sure if I totally understand your scenario. To let me better
understand your issue, could you please describe your issue more detailed
or send me (changliw_at_microsoft_dot_com) your test project for further
research?
My server side code snippets are as follows and it worked fine with
listenning set up:
---------------------------------------------------------------------------
int APIENTRY _tWinMain(...)
{...
WSADATA wsd;
SOCKET Listen;
SOCKADDR_IN InternetAddr;
WSAStartup(MAKEWORD(2,2), &wsd);
Listen = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
WSAAsyncSelect(Listen,hWnd, WM_SOCKET, FD_ACCEPT|FD_WRITE|FD_READ);
InternetAddr.sin_family = AF_INET;
InternetAddr.sin_addr.s_addr = htonl(INADDR_ANY);
InternetAddr.sin_port = htons(5150);
bind(Listen, (PSOCKADDR) &InternetAddr,sizeof(InternetAddr));
listen(Listen, 5);
......
}
LRESULT CALLBACK WndProc(...)
{
......
SOCKET Accept;
switch (message)
{
case WM_SOCKET:
if (WSAGETSELECTERROR(lParam))
{
closesocket( (SOCKET) wParam);
break;
}
switch(WSAGETSELECTEVENT(lParam))
{
case FD_ACCEPT:
// Accept an incoming connection
Accept = accept(wParam, NULL, NULL);
// Prepare accepted socket for read,
// write, and close notification
WSAAsyncSelect(Accept, hWnd,
WM_SOCKET,FD_READ|FD_WRITE|FD_CLOSE);
break;
case FD_READ:
// Receive data from the socket in wParam
break;
case FD_WRITE:
// The socket in wParam is ready for sending
data
break;
case FD_CLOSE:
// The connection is now closed
closesocket( (SOCKET)wParam);
break;
}
break;
......
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
----------------------------------------------------------------------------
--------------
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: Widows Zero Config Automation
- Next by Date: Re: About Clusters
- Previous by thread: Re: Widows Zero Config Automation
- Next by thread: RE: Missing error in WSAAsyncSelect event completion in x64 enviro
- Index(es):
Relevant Pages
|