plugins/consoles/rcons/server/win32/ClientSocket.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // ClientSocket.h
       
     2 // 
       
     3 // Copyright (c) 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #if !defined(AFX_CLIENTSOCKET_H__BF5D862F_0F6A_4476_88DD_81F067F299E5__INCLUDED_)
       
    14 #define AFX_CLIENTSOCKET_H__BF5D862F_0F6A_4476_88DD_81F067F299E5__INCLUDED_
       
    15 
       
    16 #if _MSC_VER > 1000
       
    17 #pragma once
       
    18 #endif // _MSC_VER > 1000
       
    19 
       
    20 #include "Socket.h"
       
    21 
       
    22 class CDynamicWriteBuffer;
       
    23 
       
    24 
       
    25 class MSocketReadHandler
       
    26 	{
       
    27 public:
       
    28 	virtual void SocketReadComplete() = 0;
       
    29 	};
       
    30 
       
    31 
       
    32 class CClientSocket : public CSocket
       
    33 	{
       
    34 public:
       
    35 	static CClientSocket* New(CWindow& aWindow, SOCKET aSocket);
       
    36 	virtual ~CClientSocket();
       
    37 	void Read(char* aBuf, int aLength, MSocketReadHandler& aHandler);
       
    38 	void Write(char* aBuf, int aLength);
       
    39 private:
       
    40 	CClientSocket(CWindow& aWindow, SOCKET aSocket);
       
    41 	void Construct();
       
    42 	void HandleRead(bool aNotifySynchronously);
       
    43 	void HandleWrite();
       
    44 	void NotifyReadComplete();
       
    45 protected: // From CSocket.
       
    46 	virtual LRESULT HandleSocketMessage(LPARAM aLParam);
       
    47 private:
       
    48 	MSocketReadHandler* iReadHandler;
       
    49 	char* iReadBuf;
       
    50 	int iReadLength;
       
    51 	CDynamicWriteBuffer* iWriteBuf;
       
    52 	};
       
    53 
       
    54 #endif // !defined(AFX_CLIENTSOCKET_H__BF5D862F_0F6A_4476_88DD_81F067F299E5__INCLUDED_)