testtoolsconn/stat/desktop/source/lib/inc/statsocket_block.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     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 #ifndef STATSOCKET_H
       
    22 #define STATSOCKET_H
       
    23 
       
    24 #include <winsock2.h>
       
    25 #include "statcommon.h"
       
    26 #include "stattransport.h"
       
    27 #include "../../../../Common/inc/SerialPacketSize.h"
       
    28 
       
    29 #define SOCKETTIMEOUT 300 //300 seconds
       
    30 
       
    31 class CSTATSocket : public CSTATTransport
       
    32 {
       
    33 public:
       
    34 	CSTATSocket();
       
    35 	~CSTATSocket();
       
    36 	int Initialise(void);
       
    37 	int Connect(const char *pAddress = NULL);
       
    38 	int Send(const char cIdentifier, const char *pCommand = NULL, const unsigned long ulLength = 0);
       
    39 	int Receive(char *cIdentifier, char **ppData = NULL, unsigned long *pLength = NULL);
       
    40 	int Disconnect(void);
       
    41 	int Release(void);
       
    42 	unsigned int GetMaxPacketSize(void) const;
       
    43 
       
    44 private:
       
    45 
       
    46 	SOCKET sock;
       
    47     SOCKADDR_IN sin;
       
    48 
       
    49 	SOCKET listener;
       
    50     SOCKADDR_IN remote_sin;
       
    51 
       
    52 	char *pBuffer;					// Holds received data
       
    53 	unsigned long int iBufferLength;
       
    54 									// Holds the length of the receive data 
       
    55 									// buffer
       
    56 };
       
    57 
       
    58 inline unsigned int CSTATSocket::GetMaxPacketSize(void) const
       
    59 {
       
    60 	return (KMaxTCPIPPacketSize);
       
    61 }
       
    62 
       
    63 #endif