|
1 /* |
|
2 * Copyright (c) 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: Reads from socket. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __SOCKETSREADER_H__ |
|
20 #define __SOCKETSREADER_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <in_sock.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MSocketObserver; |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 const TInt KReadBufferMaxSize = 2 * 1024; |
|
31 |
|
32 class CSocketsReader : public CActive |
|
33 { |
|
34 public: // Constructors and destructors |
|
35 |
|
36 static CSocketsReader* NewL( MSocketObserver& aObserver, |
|
37 RSocket& aSocket ); |
|
38 virtual ~CSocketsReader(); |
|
39 |
|
40 public: // New functions |
|
41 |
|
42 void ReadAsync(); // Use Cancel() to cancel |
|
43 |
|
44 protected: // from CActive |
|
45 |
|
46 void DoCancel(); |
|
47 void RunL(); |
|
48 |
|
49 private: // Constructors and destructors |
|
50 |
|
51 CSocketsReader( MSocketObserver& aObserver, RSocket& aSocket ); |
|
52 void ConstructL(); |
|
53 |
|
54 private: // New functions |
|
55 |
|
56 void IssueRead(); |
|
57 |
|
58 private: // Data |
|
59 |
|
60 RSocket& iSocket; |
|
61 MSocketObserver& iObserver; |
|
62 TBuf8<KReadBufferMaxSize> iBuffer; |
|
63 TSockXfrLength iLen; |
|
64 }; |
|
65 |
|
66 #endif // __SOCKETSREADER_H__ |
|
67 |
|
68 // End of File |