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 ()
void BaseConstructL ()
void BindL (const TInt )
void BindRandomPortL ()
void DeleteSession ( CUpnpTcpSession *)
void DoCancel ()
TInt FileReadBufferSize ()
TInt FileWriteBufferSize ()
TSockAddr * HWAddressL ()
TInt NewPortNumberL ()
void OpenSocketL ()
TInt RunError ( TInt )
void RunL ()
void ServerAddress ( TInetAddr &)
TUint ServerPort ()
void SetFileReadBufferSize ( TInt )
void SetFileWriteBufferSize ( TInt )
void SetServerAddress (const TInetAddr &)
void StartRetryTimer ()
void StopTcpServerL ()
void TimerEventL ( CUpnpNotifyTimer *)
Protected Member Functions
void AcceptConnectionL ()
void CancelRetryTimer ()
void CloseSockets ()
CUpnpTcpSession * ConnectionAcceptedL ( RSocket )
void CreateConnectionManagerSessionL ()
TBool GetServerAddress ( TInetAddr &)
void PrepareToCloseSockets ()
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
enum TState { 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,
TInt aPort,
TInt aIap
)
Constructor function. This constructor is used when connection is iniatiated from network.
Since
Series60 2.6

Parameters

RSocketServ * aSocketServ Pointer to Socket Server.
TInt aPort Number of listening port.
TInt aIap Number of active Iap to use with connections.

~CUpnpTcpServer()

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

Member Functions Documentation

AcceptConnectionL()

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

BaseConstructL()

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

BindL(const TInt)

void BindL ( const TInt aPort )
Starts to listen for incoming connections.
Since
Series60 5.0

Parameters

const TInt aPort try to bind to port

BindRandomPortL()

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

CancelRetryTimer()

void CancelRetryTimer ( ) [protected]
Cancels retry timer
Since
Series60 5.0

CloseSockets()

void CloseSockets ( ) [protected]
Closes sockets
Since
Series60 5.0

ConnectionAcceptedL(RSocket)

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

Parameters

RSocket aSocket Socket that is bound to new connection.

CreateConnectionManagerSessionL()

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

DeleteSession(CUpnpTcpSession *)

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

Parameters

CUpnpTcpSession * aSession Session to be deleted.

DoCancel()

void DoCancel ( ) [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()

void OpenSocketL ( )
Opening socket for listening
Since
Series60 5.0

PrepareToCloseSockets()

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

RunError(TInt)

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

Parameters

TInt aError from RunL.

RunL()

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

ServerAddress(TInetAddr &)

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

Parameters

TInetAddr & aAddr IP address of this server is returned to this reference.

ServerPort()

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

SetFileReadBufferSize(TInt)

void SetFileReadBufferSize ( TInt aSize )
Sets file read buffer size
Since
Series60 2.6

Parameters

TInt aSize

SetFileWriteBufferSize(TInt)

void SetFileWriteBufferSize ( TInt aSize )
Sets file write buffer size
Since
Series60 2.6

Parameters

TInt aSize

SetServerAddress(const TInetAddr &)

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

Parameters

const TInetAddr & aAddr IP address to be set.

StartRetryTimer()

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

StartToListenL()

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

StopTcpServerL()

void StopTcpServerL ( )
Stops TcpServer.
Since
Series60 2.6

TimerEventL(CUpnpNotifyTimer *)

void TimerEventL ( 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 * aTimer Pointer 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]