async sockets- different messages
Is it possible to use one win message for the listing socket and another message for the accepting sockets?
like WM_SOCKETEVENT and WM_LISTENSOCKET
Could you be a little more specific. You are being very vague and the fact that you are using Windows messages on sockets confuses me even more.
If you mean using the Windows messages in the message loop, then yes, you can use it however you want. I would advise that you keep your socket code and windows messages sperate unless it is absolutely necessary.
Ex.
case WM_SOCKETEVENT:
.....do whatever to any socket here
case WM_LISTENSOCKET:
.....i guess you would listen here
Intro Engine
If you mean using the Windows messages in the message loop, then yes, you can use it however you want. I would advise that you keep your socket code and windows messages sperate unless it is absolutely necessary.
Ex.
case WM_SOCKETEVENT:
.....do whatever to any socket here
case WM_LISTENSOCKET:
.....i guess you would listen here
Intro Engine
the problem as I see it is that when accepting a connection as server (listen on the listen socket/WM_LISTENSOCKET and accept on the server socket/WM_SERVERSOCKET) is that the server socket never have the chance to define what message to use. Accepting a socket will as far as I know just override the SOCKET object and not care one bit what WSAAsyncSelect() is set ut on that spesific socket. Or am I wrong here?
The example you provided is exactly how I want it.
That is:
the WM_LISTENSOCKET only have defined FD_ACCEPT where it accept the connection to a socket using the WM_SERVERSOCKET message and let the FD_READ/FD_WRITE etc be in the WM_SERVERSOCKET.
[edited by - invictus on February 24, 2004 8:08:56 AM]
The example you provided is exactly how I want it.
That is:
the WM_LISTENSOCKET only have defined FD_ACCEPT where it accept the connection to a socket using the WM_SERVERSOCKET message and let the FD_READ/FD_WRITE etc be in the WM_SERVERSOCKET.
[edited by - invictus on February 24, 2004 8:08:56 AM]
If I understand what you''re asking (and I may not, you seem to be slightly confused on the nature of the accept() call), then all you need to do is call WSAAsyncSelect() with FD_READ | FD_WRITE on the socket returned by the accept() function after accept() completes.
so its possible to set events AFTER accepting?? wow didnt know that. I will try that. If it works it is just what I am looking for.
is this solution recommended or should I use just 1 notification message for both listning and working socket?
[edited by - invictus on February 25, 2004 2:03:03 AM]
is this solution recommended or should I use just 1 notification message for both listning and working socket?
[edited by - invictus on February 25, 2004 2:03:03 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement