| CAsyncSocket:: SocketMessageHandler() |

Private Function | Declared in: AsyncSocket.h

## Declaration

    static LRESULT CALLBACK SocketMessageHandler(
        HWND hwnd,                          // handle to window
        UINT uMsg,                          // message identifier
        WPARAM wParam,                      // first message parameter
        LPARAM lParam);

## Description

Our window proc

## Function Body

    if (m_bShuttingDown)
        return TRUE;

    try
    {
        //first get the socket
        CAsyncSocket* cSock;

        cSock=GetSocketByID((int)wParam);

        if (cSock)
            //Socket exists
            switch (uMsg)
            {
            case WM_SOCKET_GENERAL:
                if (WSAGETSELECTEVENT(lParam) == FD_READ)
                    return cSock->OnSocketReceive(WSAGETSELECTERROR(lParam));
                else if (WSAGETSELECTEVENT(lParam) == FD_WRITE)
                    return cSock->OnSocketWrite(WSAGETSELECTERROR(lParam));
                else if (WSAGETSELECTEVENT(lParam) == FD_OOB)
                    return cSock->OnSocketOOB(WSAGETSELECTERROR(lParam));
                else if (WSAGETSELECTEVENT(lParam) == FD_CLOSE)
                    return cSock->OnSocketClose(WSAGETSELECTERROR(lParam));
                break;
            case WM_SOCKET_CONNECT:
                if (WSAGETSELECTEVENT(lParam) == FD_CONNECT)
                    return cSock->OnSocketConnect(WSAGETSELECTERROR(lParam));
                break;
            case WM_SOCKET_ACCEPT:
                if (WSAGETSELECTEVENT(lParam) == FD_ACCEPT)
                    return cSock->OnSocketAccept(WSAGETSELECTERROR(lParam));
                break;
            case WM_TIMER:
                //Inform the socket
                return cSock->OnSocketTimeout();
            default:                       /* Passes it on if unproccessed    */
                return (int)(DefWindowProc(hwnd, uMsg, wParam, lParam));
            }
        else
            return (int)(DefWindowProc(hwnd, uMsg, wParam, lParam));

        return TRUE;
    }
    ERROR_HANDLER_STATIC_RETURN(CAsyncSocket_Class,"SocketMessageHandler",TRUE)

## See Also

Class Overview | CSpoofBase | Hierarchy Chart

This web site was generated using Surveyor V4.50.811.1. Click here for more information. | Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 27 Jun 2001.