applayerpluginsandutils/httptransportplugins/httptransporthandler/csocket.cpp
branchRCL_3
changeset 19 c0c2f28ace9c
parent 18 5f1cd966e0d9
child 20 a0da872af3fa
equal deleted inserted replaced
18:5f1cd966e0d9 19:c0c2f28ace9c
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    25 const TInt KDefaultFlags		= 0;
    25 const TInt KDefaultFlags		= 0;
    26 const TInt KTcpTriggeredKeepAlive	= 2;
    26 const TInt KTcpTriggeredKeepAlive	= 2;
    27 const TInt KSocketRecvBufSize = 16 * 1024;
    27 const TInt KSocketRecvBufSize = 16 * 1024;
    28 const TInt KSocketSendBufSize = 16 * 1024;
    28 const TInt KSocketSendBufSize = 16 * 1024;
    29 const TInt KSocketDefaultSendBufSize = 4 * 1024;
    29 const TInt KSocketDefaultSendBufSize = 4 * 1024;
    30 const TUint32 KSoTcpLingerinMicroSec = 0x101F55F6;//linger constant to send close connection fast
       
    31 
    30 
    32 CSocket* CSocket::NewL(MCommsInfoProvider& aCommsInfoProvider, TSocketType aSocketType)
    31 CSocket* CSocket::NewL(MCommsInfoProvider& aCommsInfoProvider, TSocketType aSocketType)
    33 /**	
    32 /**	
    34 	The factory constructor.
    33 	The factory constructor.
    35 	@param		aCommsInfoProvider	The comms info provider object.
    34 	@param		aCommsInfoProvider	The comms info provider object.
   136         if(aSocketType != EBlankSocket)
   135         if(aSocketType != EBlankSocket)
   137             {
   136             {
   138             iSocket.SetOpt(KSoTcpNoDelay,KSolInetTcp,1);  // Disable the nagle.
   137             iSocket.SetOpt(KSoTcpNoDelay,KSolInetTcp,1);  // Disable the nagle.
   139             iSocket.SetOpt(KSORecvBuf, KSOLSocket, KSocketRecvBufSize); // Set the socket recv buf to be 16K
   138             iSocket.SetOpt(KSORecvBuf, KSOLSocket, KSocketRecvBufSize); // Set the socket recv buf to be 16K
   140             }
   139             }
   141         
       
   142         TInt lingerTimeout = iCommsInfoProvider.GetSocketImmediateCloseTimeout();
       
   143         if (lingerTimeout != KErrNotFound)
       
   144             {
       
   145             TPckgBuf<TSoTcpLingerOpt> linger;
       
   146             linger().iOnOff  = 1;
       
   147             linger().iLinger =  lingerTimeout;
       
   148             iSocket.SetOpt(KSoTcpLingerinMicroSec, KSolInetTcp, linger);
       
   149             }
       
   150         
       
   151         }
   140         }
   152     return error;
   141     return error;
   153     }
   142     }
   154 
   143 
   155 TInt CSocket::Listen(TUint aQSize, TUint16 aPort)
   144 TInt CSocket::Listen(TUint aQSize, TUint16 aPort)