testconns/statdesktop/desktop/source/lib/inc/statsocket_block.h
changeset 4 b8d1455fddc0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testconns/statdesktop/desktop/source/lib/inc/statsocket_block.h	Mon Oct 04 02:58:21 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef STATSOCKET_H
+#define STATSOCKET_H
+
+#include <winsock2.h>
+#include "statcommon.h"
+#include "stattransport.h"
+#include "../../../../Common/inc/SerialPacketSize.h"
+
+#define SOCKETTIMEOUT 300 //300 seconds
+
+class CSTATSocket : public CSTATTransport
+{
+public:
+	CSTATSocket();
+	~CSTATSocket();
+	int Initialise(void);
+	int Connect(const char *pAddress = NULL);
+	int Send(const char cIdentifier, const char *pCommand = NULL, const unsigned long ulLength = 0);
+	int Receive(char *cIdentifier, char **ppData = NULL, unsigned long *pLength = NULL);
+	int Disconnect(void);
+	int Release(void);
+	unsigned int GetMaxPacketSize(void) const;
+
+private:
+
+	SOCKET sock;
+    SOCKADDR_IN sin;
+
+	SOCKET listener;
+    SOCKADDR_IN remote_sin;
+
+	char *pBuffer;					// Holds received data
+	unsigned long int iBufferLength;
+									// Holds the length of the receive data 
+									// buffer
+};
+
+inline unsigned int CSTATSocket::GetMaxPacketSize(void) const
+{
+	return (KMaxTCPIPPacketSize);
+}
+
+#endif