Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: ES_SOCK.H
Link against: esock.lib

Class RSocketServ

class RSocketServ : public RSessionBase;

Description

Provides the Connect() function to create an IPC communication channel to the socket server. To close the channel RHandleBase provides a RHandleBase::Close() function.

The prime use for instances of RSocketServ is to establish subsession communications for RSocket, RHostResolver, RNetDatabase and RConnection. Any of the resources which are open using the session are automatically closed when the session is terminated, however it is more appropriate to issue a Close() on each subsession object before closing the session.

The following operations are also provided:

NumProtocols() - enumerates the number of protocols of which the socket server is currently aware.

GetProtocolInfo()/FindProtocol() - return information about a specific protocol.

StartProtocol() - loads a protocol asynchronously.

Note: This class is not intended for user derivation.

Derivation

Members

Defined in RSocketServ:
ClearExclusiveMode(), Connect(), Connect(), FindProtocol(), GetProtocolInfo(), InstallExtension(), NumProtocols(), RSocketServ(), SetExclusiveMode(), StartProtocol(), StopProtocol(), Version(), __DbgCheckHeap(), __DbgCheckMbuf(), __DbgFailNext(), __DbgFailNextMbuf(), __DbgMarkEnd(), __DbgMarkHeap(), __DbgMbufFreeSpace(), __DbgMbufTotalSpace(), __DbgSetMbufPoolLimit()

Inherited from RHandleBase:
Attributes(), Close(), Duplicate(), FullName(), Handle(), HandleInfo(), Name(), SetHandle(), SetHandleNC(), iHandle

Inherited from RSessionBase:
CreateSession(), EAutoAttach, EExplicitAttach, Open(), Send(), SendReceive(), SetReturnedHandle(), ShareAuto(), ShareProtected(), TAttachMode

See also


Construction and destruction


RSocketServ()

IMPORT_C RSocketServ();

Description

Default Constructor

[Top]


Member functions


Connect()

IMPORT_C TInt Connect(TUint aMessageSlots=KESockDefaultMessageSlots);

Description

Opens a session to the socket server.

The number of message slots indicates how many asychronous operations are allowed to be uncompleted at any one time by the combined resources opened on the session. The result of having too few slots is not fatal. However, operations may return KErrServerBusy indicating that no message slot was available after a small time trying.

RHandleBase::Close() should be called once the session is no longer required. All resources which are opened using the session will be automatically closed when the session terminates.

When the last session which has open resources for a protocol is closed a protocol module will be unloaded automatically by the socket server.

Parameters

TUint aMessageSlots

The number of message slots required. If not specified, 8.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


Connect()

IMPORT_C TInt Connect(const TSessionPref &aPref, TUint aMessageSlots=KESockDefaultMessageSlots);

Description

Opens a session to the socket server.

The session prefs provides a hint to the server of which protocol the client intend to use. This might result in better performance for the connection.

The number of message slots indicates how many asychronous operations are allowed to be uncompleted at any one time by the combined resources opened on the session. The result of having too few slots is not fatal. However, operations may return KErrServerBusy indicating that no message slot was available after a small time trying.

RHandleBase::Close() should be called once the session is no longer required. All resources which are opened using the session will be automatically closed when the session terminates.

When the last session which has open resources for a protocol is closed a protocol module will be unloaded automatically by the socket server.

Parameters

const TSessionPref &aPref

TUint aMessageSlots

The number of message slots required. If not specified, 8.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


Version()

IMPORT_C TVersion Version() const;

Description

Gets the version number of this client.

Return value

TVersion

Client side version number


NumProtocols()

IMPORT_C TInt NumProtocols(TUint &aCount);

Description

Gets the number of protocols the socket server is currently aware of.

The count returned can be used in conjunction with GetProtocolInfo().

Parameters

TUint &aCount

The number of protocols is returned in aCount

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


GetProtocolInfo()

IMPORT_C TInt GetProtocolInfo(TUint anIndex, TProtocolDesc &aProtocol);

Description

Gets information about a specific protocol.

Parameters

TUint anIndex

Index of required protocol description.

TProtocolDesc &aProtocol

A protocol description type to hold protocol information.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


FindProtocol()

IMPORT_C TInt FindProtocol(const TProtocolName &aName, TProtocolDesc &aProtocol);

Description

Gets information about a specific protocol, identified by it's name.

There is no wildcard support.

Parameters

const TProtocolName &aName

Typed descriptor which identifies a protocol name.

TProtocolDesc &aProtocol

A protocol description type to hold protocol information.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


StartProtocol()

Capability: NetworkControl Protocol starting is a critical operation in the comms process and must be restricted

IMPORT_C void StartProtocol(TUint anAddrFamily, TUint aSockType, TUint aProtocol, TRequestStatus &aStatus);

Description

Loads a specified protocol asynchronously.

The protocol is specified by family, socket type and protocol identifier.

Note that client programs do not normally need to call this function, as loading of a protocol is done automatically by the Sockets Server when a socket of that protocol is opened. Some applications may, however, need to ensure that an open socket call will not take a significant amount of time (e.g. IrCOMM). This function can be called by such applications to preload the protocol.

There is no way to cancel this operation once it has been called.

Parameters

TUint anAddrFamily

Integer which identifies a protocol suite.

TUint aSockType

Integer which identifies a type of socket.

TUint aProtocol

Integer which identifies a specific protocol in a family.

TRequestStatus &aStatus

On completion will contain an error code: see the system-wide error codes.


StopProtocol()

Capability: NetworkControl Protocol stopping is a critical operation in the comms process and must be restricted

IMPORT_C void StopProtocol(TUint anAddrFamily, TUint aSockType, TUint aProtocol, TRequestStatus &aStatus);

Description

Unload a protocol asynchronously - note it will fail if there are any resources open

Parameters

TUint anAddrFamily

Integer which identifies a protocol suite

TUint aSockType

Integer which identifies a type of socket

TUint aProtocol

Integer which identifies a specific protocol in a family

TRequestStatus &aStatus

On completion, will contain a system-wide error codes


InstallExtension()

Capability: NetworkControl Loading extensions to

IMPORT_C TInt InstallExtension(const TDesC &aDllName, const TDesC &aArgs=TPtrC());

Description

Install an Esock Extension. PLEASE NOTE: This API is currently unsupported, calling it will always return KErrNotSupported.

Parameters

const TDesC &aDllName

DllName for Esock Extension

const TDesC &aArgs

argument for Esock Extension

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


SetExclusiveMode()

Capability: NetworkControl Restricting

IMPORT_C void SetExclusiveMode(TRequestStatus &aStatus);

Description

Set this session as the socket server exclusive session. PLEASE NOTE: This API is currently unsupported, calling it will always return KErrNone but without actually doing anything.

Parameters

TRequestStatus &aStatus

On completion, will contain a system-wide error codes


ClearExclusiveMode()

IMPORT_C void ClearExclusiveMode();

Description

Clear exclusive mode for this session PLEASE NOTE: This API is currently unsupported, calling it will always return KErrNone but without actually doing anything.


__DbgMarkHeap()

IMPORT_C TInt __DbgMarkHeap();

Description

Set a heap mark in the socket server

Return value

TInt


__DbgCheckHeap()

IMPORT_C TInt __DbgCheckHeap(TInt aCount);

Description

Set a heap mark in the socket server

Parameters

TInt aCount

Return value

TInt


__DbgMarkEnd()

IMPORT_C TInt __DbgMarkEnd(TInt aCount);

Description

Set a heap mark in the socket server

Parameters

TInt aCount

Return value

TInt


__DbgFailNext()

IMPORT_C TInt __DbgFailNext(TInt aCount);

Description

Set a heap mark in the socket server

Parameters

TInt aCount

Return value

TInt


__DbgFailNextMbuf()

IMPORT_C TInt __DbgFailNextMbuf(TInt aCount);

Description

Set a Mbuf mark in the socket server

Parameters

TInt aCount

Return value

TInt


__DbgSetMbufPoolLimit()

IMPORT_C TInt __DbgSetMbufPoolLimit(TInt asize);

Description

Set the Mbuf pool limit

Parameters

TInt asize

Return value

TInt


__DbgCheckMbuf()

IMPORT_C TInt __DbgCheckMbuf(TInt asize);

Description

Set the Mbuf pool limit

Parameters

TInt asize

Return value

TInt


__DbgMbufFreeSpace()

IMPORT_C TInt __DbgMbufFreeSpace();

Description

Get the amount of free space in the MBuf manager

Return value

TInt


__DbgMbufTotalSpace()

IMPORT_C TInt __DbgMbufTotalSpace();

Description

Get the amount of free space in the MBuf manager

Return value

TInt