testconns/statdesktop/desktop/source/common/transport/src/cclientsocket.cpp
changeset 4 b8d1455fddc0
equal deleted inserted replaced
2:73b88125830c 4:b8d1455fddc0
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "stdafx.h"
       
    22 
       
    23 #include "CClientSocket.h"
       
    24 #include "statsocket.h"
       
    25 
       
    26 #include <stddef.h>
       
    27 
       
    28 #ifdef _DEBUG
       
    29 #undef THIS_FILE
       
    30 static char BASED_CODE THIS_FILE[] = __FILE__;
       
    31 #endif
       
    32 
       
    33 IMPLEMENT_DYNAMIC(CClientSocket, CSocket)
       
    34 
       
    35 CClientSocket::CClientSocket(CSTATSocket* pSoc)
       
    36 {
       
    37 	m_pSoc = pSoc;
       
    38 }
       
    39 
       
    40 // callback function when data is waiting
       
    41 void CClientSocket::OnReceive(int nErrorCode)
       
    42 {
       
    43 	CSocket::OnReceive(nErrorCode);
       
    44 
       
    45 	while (!m_pSoc->ReceiveData())
       
    46 		Sleep(100);
       
    47 }
       
    48 
       
    49 // callback function when connection is waiting
       
    50 void CClientSocket::OnAccept(int nErrorCode)
       
    51 {
       
    52 	CSocket::OnAccept(nErrorCode);
       
    53 	m_pSoc->Connect(NULL);
       
    54 }
       
    55