CUpnpTcpServer Class Reference

class CUpnpTcpServer : public CActive

A virtual base class for TCP servers. Includes a server socket and methods starting server socket, accepting connections and creating CUpnpTcpSessions for incoming connections. After creating tcp session and adding it to active sessions' tableserver returns to listening for new connections and the tcp session takes care about whole communication with remote host. After handling connection the session is destroyed and removed from sessions' list.

DLNAwebserver.lib
Since
Series60 2.6

Inherits from

Public Member Functions
CUpnpTcpServer(RSocketServ *, TInt, TInt)
~CUpnpTcpServer()
voidBaseConstructL()
voidBindL(const TInt)
voidBindRandomPortL()
voidDeleteSession(CUpnpTcpSession *)
voidDoCancel()
TInt FileReadBufferSize()
TInt FileWriteBufferSize()
TSockAddr *HWAddressL()
TInt NewPortNumberL()
voidOpenSocketL()
TInt RunError(TInt)
voidRunL()
voidServerAddress(TInetAddr &)
TUint ServerPort()
voidSetFileReadBufferSize(TInt)
voidSetFileWriteBufferSize(TInt)
voidSetServerAddress(const TInetAddr &)
voidStartRetryTimer()
voidStopTcpServerL()
voidTimerEventL(CUpnpNotifyTimer *)
Protected Member Functions
voidAcceptConnectionL()
voidCancelRetryTimer()
voidCloseSockets()
CUpnpTcpSession *ConnectionAcceptedL(RSocket)
voidCreateConnectionManagerSessionL()
TBool GetServerAddress(TInetAddr &)
voidPrepareToCloseSockets()
TInt StartToListenL()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enumTState { ENotListening, EAccepting }
Inherited Enumerations
CActive:TPriority
Protected Attributes
TInt iActiveIap
RSocket iClientSocket
TCommDbConnPref iCommDbPref
CUpnpConnectionManagerProxy *iConnectionManagerProxy
TInt iFileReadBufferSize
TInt iFileWriteBufferSize
CUpnpNotifyTimer *iRetrySocketTimer
TInetAddr iServerAddress
TUint iServerPort
RSocket iServerSocket
RPointerArray< CUpnpTcpSession >iSessionList
RSocketServ *iSocketServ
TState iState
MUpnpHttpServerTransactionCreator *iTransactionCreator
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CUpnpTcpServer(RSocketServ *, TInt, TInt)

CUpnpTcpServer(RSocketServ *aSocketServ,
TIntaPort,
TIntaIap
)
Constructor function. This constructor is used when connection is iniatiated from network.
Since
Series60 2.6

Parameters

RSocketServ * aSocketServPointer to Socket Server.
TInt aPortNumber of listening port.
TInt aIapNumber of active Iap to use with connections.

~CUpnpTcpServer()

~CUpnpTcpServer()[virtual]
Virtual destructor function.
Since
Series60 2.6

Member Functions Documentation

AcceptConnectionL()

voidAcceptConnectionL()[protected]
Accepts new connection ans starts to listen for new connections.
Since
Series60 2.6

BaseConstructL()

voidBaseConstructL()
TcpServer might-leave initialization method. NOTE: Must be called by extending class
Since
Series60 2.6

BindL(const TInt)

voidBindL(const TIntaPort)
Starts to listen for incoming connections.
Since
Series60 5.0

Parameters

const TInt aPorttry to bind to port

BindRandomPortL()

voidBindRandomPortL()
Starts to listen for incoming connections.
Since
Series60 5.0

CancelRetryTimer()

voidCancelRetryTimer()[protected]
Cancels retry timer
Since
Series60 5.0

CloseSockets()

voidCloseSockets()[protected]
Closes sockets
Since
Series60 5.0

ConnectionAcceptedL(RSocket)

CUpnpTcpSession *ConnectionAcceptedL(RSocketaSocket)[protected, pure virtual]
Callback function for new connection creation.
Since
Series60 2.6

Parameters

RSocket aSocketSocket that is bound to new connection.

CreateConnectionManagerSessionL()

voidCreateConnectionManagerSessionL()[protected]
Connects to the Connection Manager
Since
Series60 5.0

DeleteSession(CUpnpTcpSession *)

voidDeleteSession(CUpnpTcpSession *aSession)
Deletes given session.
Since
Series60 2.6

Parameters

CUpnpTcpSession * aSessionSession to be deleted.

DoCancel()

voidDoCancel()[virtual]
Cancel active object requests Standard active object function
Since
Series60 2.6

FileReadBufferSize()

TInt FileReadBufferSize()
Returns file write buffer size
Since
Series60 2.6

FileWriteBufferSize()

TInt FileWriteBufferSize()
Returns file read buffer size
Since
Series60 2.6

GetServerAddress(TInetAddr &)

TBool GetServerAddress(TInetAddr &aAddr)[protected]
Gets the value of iServerAddress
Since
Series60 3.2

Parameters

TInetAddr & aAddr

HWAddressL()

TSockAddr *HWAddressL()
Returns the Hardware address of active IAP.
Since
Series60 2.6

NewPortNumberL()

TInt NewPortNumberL()
Returns a new available port number.
Since
Series60 2.6

OpenSocketL()

voidOpenSocketL()
Opening socket for listening
Since
Series60 5.0

PrepareToCloseSockets()

voidPrepareToCloseSockets()[protected]
Prepares to close sockets
Since
Series60 5.0

RunError(TInt)

TInt RunError(TIntaError)[virtual]
Do active object operations Standard active object function
Since
Series60 2.6

Parameters

TInt aErrorfrom RunL.

RunL()

voidRunL()[virtual]
Do active object operations Standard active object function
Since
Series60 2.6

ServerAddress(TInetAddr &)

voidServerAddress(TInetAddr &aAddr)
Returns the IP address of this server.
Since
Series60 2.6

Parameters

TInetAddr & aAddrIP address of this server is returned to this reference.

ServerPort()

TUint ServerPort()
Returns the port of this server.
Since
Series60 2.6

SetFileReadBufferSize(TInt)

voidSetFileReadBufferSize(TIntaSize)
Sets file read buffer size
Since
Series60 2.6

Parameters

TInt aSize

SetFileWriteBufferSize(TInt)

voidSetFileWriteBufferSize(TIntaSize)
Sets file write buffer size
Since
Series60 2.6

Parameters

TInt aSize

SetServerAddress(const TInetAddr &)

voidSetServerAddress(const TInetAddr &aAddr)
Set the new IP address
Since
Series60 5.0 HN

Parameters

const TInetAddr & aAddrIP address to be set.

StartRetryTimer()

voidStartRetryTimer()
Starts retrying accepting the new connection.
Since
Series60 3.2

StartToListenL()

TInt StartToListenL()[protected]
Starts to listen a socket.
Since
Series60 2.6

StopTcpServerL()

voidStopTcpServerL()
Stops TcpServer.
Since
Series60 2.6

TimerEventL(CUpnpNotifyTimer *)

voidTimerEventL(CUpnpNotifyTimer *aTimer)
Callback from iRetrySocketTimer. This method tries to open new socket again, because last time server socket binding has failed.
Since
Series60 2.6

Parameters

CUpnpNotifyTimer * aTimerPointer to timer that has expired.

Member Enumerations Documentation

Enum TState

Enum for state of server.

Enumerators

ENotListening
EAccepting

Member Data Documentation

TInt iActiveIap

TInt iActiveIap[protected]

RSocket iClientSocket

RSocket iClientSocket[protected]

TCommDbConnPref iCommDbPref

TCommDbConnPref iCommDbPref[protected]

CUpnpConnectionManagerProxy * iConnectionManagerProxy

CUpnpConnectionManagerProxy *iConnectionManagerProxy[protected]

TInt iFileReadBufferSize

TInt iFileReadBufferSize[protected]

TInt iFileWriteBufferSize

TInt iFileWriteBufferSize[protected]

CUpnpNotifyTimer * iRetrySocketTimer

CUpnpNotifyTimer *iRetrySocketTimer[protected]

TInetAddr iServerAddress

TInetAddr iServerAddress[protected]

TUint iServerPort

TUint iServerPort[protected]

RSocket iServerSocket

RSocket iServerSocket[protected]

RPointerArray< CUpnpTcpSession > iSessionList

RPointerArray< CUpnpTcpSession >iSessionList[protected]

RSocketServ * iSocketServ

RSocketServ *iSocketServ[protected]

TState iState

TState iState[protected]

MUpnpHttpServerTransactionCreator * iTransactionCreator

MUpnpHttpServerTransactionCreator *iTransactionCreator[protected]