Symbian3/PDK/Source/GUID-00552575-AB10-4CB3-A37B-D83AE5975811.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-00552575-AB10-4CB3-A37B-D83AE5975811" xml:lang="en"><title>HTTP
       
    13 session ID</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>HTTP session ID is an optional non-negative integer which is attached to
       
    15 the session and any sockets it creates. The session ID is set on sockets by
       
    16 using <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-0DD7A667-7043-3D6B-A086-32DD222C199B"><apiname>RSocket::SetOpt()</apiname></xref>. </p>
       
    17 <p>With this session ID, clients can specify an integer ID for an HTTP session,
       
    18 which is assigned to subsequent sockets. An ID that is set applies to subsequent
       
    19 socket connections. </p>
       
    20 <p>HTTP session ID can be accessed using a Flow hook implementing the <codeph>SetFlowOption()</codeph> method,
       
    21 which is called whenever <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-0DD7A667-7043-3D6B-A086-32DD222C199B"><apiname>RSocket::SetOpt()</apiname></xref> is called. The
       
    22 Flow hook helps determine if a socket came from a specific session. </p>
       
    23 <p>The session ID is set when the socket is created and is not changed. To
       
    24 find the session ID of a socket, the flow object must look for Set Option
       
    25 commands that request setting session ID. The ID that is set can be saved
       
    26 in the Flow hook object, and used later when needed. This can be done using
       
    27 an <codeph>iSessionId</codeph> variable to hold the value, as shown in the
       
    28 following example: </p>
       
    29 <codeblock id="GUID-11827E76-ECD4-52E7-89B0-0152A4CF5A47" xml:space="preserve">#include &lt;HTTPSocketConstants.h&gt; // option consts defined here.... 
       
    30 class CMip4Protocol : public CIp6Hook 
       
    31 { 
       
    32 public: 
       
    33 ... 
       
    34 virtual TInt SetFlowOption(TUint aLevel, TUint aName, const TDesC8 &amp;aOption, CFlowContext &amp;aFlow); 
       
    35 private: 
       
    36 ...
       
    37 TInt iSessionId; // session ID is stored here. Should be initialized to KErrNotFound
       
    38 };</codeblock>
       
    39 <p>The HTTP session ID, <codeph>HTTP::ESessionId</codeph>, when set, is accessed
       
    40 using the session’s connection info object. For example: </p>
       
    41 <codeblock id="GUID-E46A1152-E4CC-5FFE-8686-68605C6D4909" xml:space="preserve">RHTTPSession session;
       
    42 ...
       
    43 RHTTPConnectionInfo ConnectionInfo = session.ConnectionInfo();
       
    44 </codeblock>
       
    45 <p>To access the value, <codeph>RString</codeph> must first be extracted from
       
    46 the string pool. For example: </p>
       
    47 <codeblock id="GUID-C833CEEC-A8E8-5687-8F47-C1836FCD0933" xml:space="preserve">RStringF sessionId = session.StringPool().StringF(HTTP::ESessionId, RHTTPSession::GetTable());
       
    48 sessionId.Close();</codeblock>
       
    49 </conbody></concept>