00001 /*00002 * Copyright (c) 2002 Barak Weichselbaum <barak@komodia.com>00003 * All rights reserved.00004 *00005 * This program is free software; you can redistribute it and/or00006 * modify it under the terms of the GNU General Public License00007 * as published by the Free Software Foundation; either version 200008 * of the License, or (at your option) any later version.00009 * 00010 * This program is distributed in the hope that it will be useful,00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the00013 * GNU General Public License for more details.00014 * 00015 * You should have received a copy of the GNU General Public License00016 * along with this program; if not, write to the Free Software00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.00018 *00019 * If you would like to receive a copy of this library outside the GNU GPL00020 * license, contact us for further details.00021 *00022 * Contact info:00023 * Site: http://www.komodia.com00024 * Email: sales@komodia.com00025 */00026
00027 #if !defined(AFX_SOCKETPOOLSOCKET_H__2390326C_7FD3_41A2_AC89_36A6582BEB91__INCLUDED_)00028#define AFX_SOCKETPOOLSOCKET_H__2390326C_7FD3_41A2_AC89_36A6582BEB91__INCLUDED_00029
00030 #if _MSC_VER > 100000031 #pragma once00032 #endif // _MSC_VER > 100000033
00034 #include "TCPSocketAsync.h"00035
00036 KOMODIA_NAMESPACE_START00037
00038 class CSocketPool;
00039
00040class CSocketPoolSocket : publicCTCPSocketAsync00041 {
00042 public:
00043 //Our ID00044typedef DWORD PoolSocketID;
00045 public:
00046 //Get our ID00047 PoolSocketIDGetID()const;
00048
00049 //Connect to the destination00050 BOOL Connect();
00051
00052 //Set the connection data00053 voidSetConnectionData(const std::string& rAddress,
00054 unsignedshort usPort);
00055
00056 //Ctor and dtor00057 CSocketPoolSocket(CSocketPool* pFather);
00058 virtual~CSocketPoolSocket();
00059 protected:
00060 //Connection event00061 virtual BOOL OnSocketConnect(int iErrorCode);
00062
00063 //Our disconnection event00064 virtual BOOL OnSocketClose(int iErrorCode);
00065
00066 //Close the pool socket00067 voidClosePoolSocket();
00068 private:
00069 //No copy ctor00070 CSocketPoolSocket(constCSocketPoolSocket& rSocket);
00071
00072 //Connection data (where we want to connect to)00073 std::string m_sAddress;
00074 unsignedshort m_usPort;
00075
00076 //Our father00077 CSocketPool* m_pFather;
00078 };
00079
00080 KOMODIA_NAMESPACE_END00081
00082 #endif // !defined(AFX_SOCKETPOOLSOCKET_H__2390326C_7FD3_41A2_AC89_36A6582BEB91__INCLUDED_)