| CAsyncSocket |

Class | Declared in: AsyncSocket.h

## Overview

Copyright (c) 2000 Barak Weichselbaum <barak@komodia.com> All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Contact info: Site: http://www.komodia.com Email: barak@komodia.com

Hierarchy Chart

## Base Classes

|  | CSpoofBase |

## Data Items

| BOOL | m_bFreeze | Should we freeze this thread ?
| static BOOL | m_bShuttingDown | Are we shutting down
| HWND | m_hLocalWindowHandle | Our window's handle
| static BOOL | m_Initialized | Are we initialized
| static HINSTANCE | m_Instance | Instance of our window
| BOOL | m_List | Are we in the list
| `CSocketThreadManager` * | m_pLocalThreadManager | Our local thread manager (to allow custom thread mangement)
| static `CSocketThreadManager` * | m_pThreadManager | Our thread manager (global)
| int | m_SocketID | ID of our socket
| static SocketMap | m_SocketMap | Our list of sockets
| BOOL | m_Timeout | Timeout indicator
| static BOOL | m_Window | Construction/Destruction
| static HWND | m_WindowHandle | Our window's handle

## Constructors

|  | CAsyncShutdown::CAsyncShutdown() |
|  | CAsyncSocket() | ctor and dtor

## Destructors

|  | CAsyncShutdown::~CAsyncShutdown() |
| virtual | ~CAsyncSocket() |

## Functions

| void | AddSocketToList() | Add the socket to the list
| void | AllocateHandle() | Allocate ourself a window
| void | CAsyncShutdown::NotifyShutdown() |
| BOOL | CheckAsyncSocketValid() const | Check if the socket is valid
| void | DeAllocateHandle() | Remove from thread info
| BOOL | DisableAsync() | Disable the async notification
| void | FreezeThread() | Notify that don't select this thread after socket destruction
| virtual SOCKET | GetAsyncHandle() const=0 | Get the socket handle
| static HINSTANCE | GetInstance() | Get the instance of our APP
| static `CAsyncSocket` * | GetSocketByID( int iSockID ) | Find a socket
| int | GetSocketID() const | Get the ID of the socket
| `CSocketThreadManager` * | GetThreadManager() const | Get our thread manager (global or local)
| HWND | GetWindowHandle() const | Get the handle of the window
| static void | Initialize() | Initialize all the handlers
| BOOL | IsTimeout() const | Do we have a timeout
| BOOL | KillTimer() | Disable the time
| virtual BOOL | OnSocketAccept( int iErrorCode )=0 |
| virtual BOOL | OnSocketClose( int iErrorCode )=0 |
| virtual BOOL | OnSocketConnect( int iErrorCode )=0 |
| virtual BOOL | OnSocketOOB( int iErrorCode )=0 |
| virtual BOOL | OnSocketReceive( int iErrorCode )=0 |
| virtual BOOL | OnSocketTimeout()=0 | Messaging methods
| virtual BOOL | OnSocketWrite( int iErrorCode )=0 |
| static BOOL | RegisterWindow() | Register our window
| static BOOL | RemoveHandlers() | Remove the handlers
| void | RemoveSocketFromList() | Remove the socket from the list
| virtual BOOL | SetAsync()=0 | Go to async regular mode
| static BOOL | SetHandlers() | Create our handlers
| static void | SetInstance( HINSTANCE hInst ) | Set the instace of our app
| BOOL | SetTimeout( int iMs ) | Create a timeout
| static void | Shutdown() | Indicate a system shutdown
| void | SocketClosing() | Close the timeout if needed
| static LRESULT CALLBACK | SocketMessageHandler( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) | Our window proc

## Custom Code

- Custom Code in Header Before Includes (92 bytes)
- Custom Code in Header After Includes (995 bytes)
- Custom Code in Header Private Section (341 bytes)

## Implementation Details

File(s)
  C:\dev\Komodia\AsyncSocket.cpp
  C:\dev\Komodia\AsyncSocket.h

Header Includes

  SpoofBase.h |
  map |

Source Includes

  stdafx.h | for precompiled header directive
  AsyncSocket.h |
  SocketThreadManager.h |

Owner
  LibV3

Last Modified
  26-Jun-01 3:07:01 PM

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.