equal
deleted
inserted
replaced
1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2003-2009 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 |
30 |
31 |
31 CSocket* CSocket::NewL(MCommsInfoProvider& aCommsInfoProvider, TSocketType aSocketType) |
32 CSocket* CSocket::NewL(MCommsInfoProvider& aCommsInfoProvider, TSocketType aSocketType) |
32 /** |
33 /** |
33 The factory constructor. |
34 The factory constructor. |
34 @param aCommsInfoProvider The comms info provider object. |
35 @param aCommsInfoProvider The comms info provider object. |
135 if(aSocketType != EBlankSocket) |
136 if(aSocketType != EBlankSocket) |
136 { |
137 { |
137 iSocket.SetOpt(KSoTcpNoDelay,KSolInetTcp,1); // Disable the nagle. |
138 iSocket.SetOpt(KSoTcpNoDelay,KSolInetTcp,1); // Disable the nagle. |
138 iSocket.SetOpt(KSORecvBuf, KSOLSocket, KSocketRecvBufSize); // Set the socket recv buf to be 16K |
139 iSocket.SetOpt(KSORecvBuf, KSOLSocket, KSocketRecvBufSize); // Set the socket recv buf to be 16K |
139 } |
140 } |
|
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 |
140 } |
151 } |
141 return error; |
152 return error; |
142 } |
153 } |
143 |
154 |
144 TInt CSocket::Listen(TUint aQSize, TUint16 aPort) |
155 TInt CSocket::Listen(TUint aQSize, TUint16 aPort) |