RE: Missing error in WSAAsyncSelect event completion in x64 enviro



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.
======================================================

.



Relevant Pages

  • RE: can I use IAsyncResult.IsCompleted Property to know if Endxxx was already called?
    ... Normally, in the Socket Asynchronous programming model, before you call ... This callback method will execute in a separate thread ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Missing error in WSAAsyncSelect event completion in x64 enviro
    ... is down on the server and the code is trying to connect to a downed listener. ... LRESULT WINAPI StartWorkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ... SOCKET Listen; ... Microsoft Online Community Support ...
    (microsoft.public.win32.programmer.networks)
  • Re: Select between raw socket programming vs. WCF
    ... Does WCF support compression? ... Use raw socket and deine your own communication protocol to transfer ... For WCF, it does support XML webservice conform interface/endpoint, ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.webservices)
  • RE: looking for samples
    ... A reusable, high performance, socket server class - Part 1 ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ... project analysis and dump analysis issues. ...
    (microsoft.public.inetserver.asp.components)
  • Re: Simple TCP Socket Communicator - Please Help
    ... just like what you can do in unmanaged socket application, ... Microsoft MSDN Online Support Lead ... TcpClient to receive data from server, ... private StreamReader _reader; ...
    (microsoft.public.dotnet.framework)