RSocket Class Reference

class RSocket : public RCommsSubSession

Provides a client endpoint to a protocol. It provides functions for socket creation, reading, writing, passive connection, active connection, setting addresses and querying addresses. Use this class as an endpoint for network type communications. It provides the following services:

reading from and writing to protocol

binding to addresses

active connecting

passive connection through the listen/accept model

Before using any of these services, a connection to a socket server session must have been made and the socket must be open.

Since v5.0

Public Member Functions
RSocket()
IMPORT_C voidAccept(RSocket &, TRequestStatus &)
IMPORT_C voidAccept(RSocket &, TDes8 &, TRequestStatus &)
IMPORT_C TIntBind(TSockAddr &)
IMPORT_C voidCancelAccept()
IMPORT_C voidCancelAll()
IMPORT_C voidCancelConnect()
IMPORT_C voidCancelIoctl()
IMPORT_C voidCancelRead()
IMPORT_C voidCancelRecv()
IMPORT_C voidCancelSend()
IMPORT_C voidCancelWrite()
IMPORT_C voidClose()
IMPORT_C voidConnect(TSockAddr &, TRequestStatus &)
IMPORT_C voidConnect(TSockAddr &, const TDesC8 &, TDes8 &, TRequestStatus &)
IMPORT_C TIntGetDisconnectData(TDes8 &)
IMPORT_C TIntGetOpt(TUint, TUint, TDes8 &)
IMPORT_C TIntGetOpt(TUint, TUint, TInt &)
IMPORT_C TIntInfo(TProtocolDesc &)
IMPORT_C voidIoctl(TUint, TRequestStatus &, TDes8 *, TUint)
IMPORT_C TIntListen(TUint)
IMPORT_C TIntListen(TUint, const TDesC8 &)
IMPORT_C voidLocalName(TSockAddr &)
IMPORT_C TUintLocalPort()
IMPORT_C TIntName(TName &)
IMPORT_C TIntOpen(RSocketServ &, TUint, TUint, TUint)
IMPORT_C TIntOpen(RSocketServ &, TUint, TUint, TUint, RConnection &)
IMPORT_C TIntOpen(RSocketServ &, TUint, TUint, TUint, RSubConnection &)
IMPORT_C TIntOpen(RSocketServ &, const TDesC &)
IMPORT_C TIntOpen(RSocketServ &)
IMPORT_C voidRead(TDes8 &, TRequestStatus &)
IMPORT_C voidRecv(TDes8 &, TUint, TRequestStatus &)
IMPORT_C voidRecv(TDes8 &, TUint, TRequestStatus &, TSockXfrLength &)
IMPORT_C voidRecvFrom(TDes8 &, TSockAddr &, TUint, TRequestStatus &)
IMPORT_C voidRecvFrom(TDes8 &, TSockAddr &, TUint, TRequestStatus &, TSockXfrLength &)
IMPORT_C voidRecvOneOrMore(TDes8 &, TUint, TRequestStatus &, TSockXfrLength &)
IMPORT_C voidRecvOneOrMore(TDes8 &, TUint, TRequestStatus &)
IMPORT_C voidRemoteName(TSockAddr &)
IMPORT_C voidSend(const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidSend(const TDesC8 &, TUint, TRequestStatus &, TSockXfrLength &)
IMPORT_C voidSendTo(const TDesC8 &, TSockAddr &, TUint, TRequestStatus &)
IMPORT_C voidSendTo(const TDesC8 &, TSockAddr &, TUint, TRequestStatus &, TSockXfrLength &)
IMPORT_C TIntSetLocalPort(TInt)
IMPORT_C TIntSetOpt(TUint, TUint, const TDesC8 &)
IMPORT_C TIntSetOpt(TUint, TUint, TInt)
IMPORT_C voidShutdown(TShutdown, TRequestStatus &)
IMPORT_C voidShutdown(TShutdown, const TDesC8 &, TDes8 &, TRequestStatus &)
IMPORT_C TIntTransfer(RSocketServ &, const TDesC &)
IMPORT_C voidWrite(const TDesC8 &, TRequestStatus &)
Inherited Functions
RSubSessionBase::CloseSubSession(TInt)
RSubSessionBase::CreateAutoCloseSubSession(RSessionBase &,TInt,const TIpcArgs &)
RSubSessionBase::CreateSubSession(const RSessionBase &,TInt)
RSubSessionBase::CreateSubSession(const RSessionBase &,TInt,const TIpcArgs &)
RSubSessionBase::RSubSessionBase()
RSubSessionBase::Send(TInt)const
RSubSessionBase::Send(TInt,const TIpcArgs &)const
RSubSessionBase::SendReceive(TInt)const
RSubSessionBase::SendReceive(TInt,TRequestStatus &)const
RSubSessionBase::SendReceive(TInt,const TIpcArgs &)const
RSubSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSubSessionBase::Session()const
RSubSessionBase::SubSessionHandle()const
Public Member Enumerations
enumTShutdown { ENormal, EStopInput, EStopOutput, EImmediate }

Constructor & Destructor Documentation

RSocket()

IMPORT_CRSocket()

Member Functions Documentation

Accept(RSocket &, TRequestStatus &)

IMPORT_C voidAccept(RSocket &aBlankSocket,
TRequestStatus &aStatus
)

Parameters

RSocket & aBlankSocket
TRequestStatus & aStatus

Accept(RSocket &, TDes8 &, TRequestStatus &)

IMPORT_C voidAccept(RSocket &aBlankSocket,
TDes8 &aConnectData,
TRequestStatus &aStatus
)

Parameters

RSocket & aBlankSocket
TDes8 & aConnectData
TRequestStatus & aStatus

Bind(TSockAddr &)

IMPORT_C TIntBind(TSockAddr &anAddr)

Parameters

TSockAddr & anAddr

CancelAccept()

IMPORT_C voidCancelAccept()

CancelAll()

IMPORT_C voidCancelAll()

CancelConnect()

IMPORT_C voidCancelConnect()

CancelIoctl()

IMPORT_C voidCancelIoctl()

CancelRead()

IMPORT_C voidCancelRead()

CancelRecv()

IMPORT_C voidCancelRecv()

CancelSend()

IMPORT_C voidCancelSend()

CancelWrite()

IMPORT_C voidCancelWrite()

Close()

IMPORT_C voidClose()

Connect(TSockAddr &, TRequestStatus &)

IMPORT_C voidConnect(TSockAddr &anAddr,
TRequestStatus &aStatus
)

Parameters

TSockAddr & anAddr
TRequestStatus & aStatus

Connect(TSockAddr &, const TDesC8 &, TDes8 &, TRequestStatus &)

IMPORT_C voidConnect(TSockAddr &anAddr,
const TDesC8 &aConnectDataOut,
TDes8 &aConnectDataIn,
TRequestStatus &aStatus
)

Parameters

TSockAddr & anAddr
const TDesC8 & aConnectDataOut
TDes8 & aConnectDataIn
TRequestStatus & aStatus

GetDisconnectData(TDes8 &)

IMPORT_C TIntGetDisconnectData(TDes8 &aDesc)

Parameters

TDes8 & aDesc

GetOpt(TUint, TUint, TDes8 &)

IMPORT_C TIntGetOpt(TUintanOptionName,
TUintanOptionLevel,
TDes8 &anOption
)

Parameters

TUint anOptionName
TUint anOptionLevel
TDes8 & anOption

GetOpt(TUint, TUint, TInt &)

IMPORT_C TIntGetOpt(TUintanOptionName,
TUintanOptionLevel,
TInt &anOption
)

Parameters

TUint anOptionName
TUint anOptionLevel
TInt & anOption

Info(TProtocolDesc &)

IMPORT_C TIntInfo(TProtocolDesc &aProtocol)

Parameters

TProtocolDesc & aProtocol

Ioctl(TUint, TRequestStatus &, TDes8 *, TUint)

IMPORT_C voidIoctl(TUintaCommand,
TRequestStatus &aStatus,
TDes8 *aDesc = NULL,
TUintaLevel =  KLevelUnspecified
)

Parameters

TUint aCommand
TRequestStatus & aStatus
TDes8 * aDesc = NULL
TUint aLevel =  KLevelUnspecified

Listen(TUint)

IMPORT_C TIntListen(TUintqSize)

Parameters

TUint qSize

Listen(TUint, const TDesC8 &)

IMPORT_C TIntListen(TUintqSize,
const TDesC8 &aConnectData
)

Parameters

TUint qSize
const TDesC8 & aConnectData

LocalName(TSockAddr &)

IMPORT_C voidLocalName(TSockAddr &anAddr)

Parameters

TSockAddr & anAddr

LocalPort()

IMPORT_C TUintLocalPort()

Name(TName &)

IMPORT_C TIntName(TName &aName)

Parameters

TName & aName

Open(RSocketServ &, TUint, TUint, TUint)

IMPORT_C TIntOpen(RSocketServ &aServer,
TUintaddrFamily,
TUintsockType,
TUintprotocol
)

Parameters

RSocketServ & aServer
TUint addrFamily
TUint sockType
TUint protocol

Open(RSocketServ &, TUint, TUint, TUint, RConnection &)

IMPORT_C TIntOpen(RSocketServ &aServer,
TUintaddrFamily,
TUintsockType,
TUintprotocol,
RConnection &aConnection
)

Parameters

RSocketServ & aServer
TUint addrFamily
TUint sockType
TUint protocol
RConnection & aConnection

Open(RSocketServ &, TUint, TUint, TUint, RSubConnection &)

IMPORT_C TIntOpen(RSocketServ &aServer,
TUintaddrFamily,
TUintsockType,
TUintprotocol,
RSubConnection &aSubConnection
)

Parameters

RSocketServ & aServer
TUint addrFamily
TUint sockType
TUint protocol
RSubConnection & aSubConnection

Open(RSocketServ &, const TDesC &)

IMPORT_C TIntOpen(RSocketServ &aServer,
const TDesC &aName
)

Parameters

RSocketServ & aServer
const TDesC & aName

Open(RSocketServ &)

IMPORT_C TIntOpen(RSocketServ &aServer)

Parameters

RSocketServ & aServer

Read(TDes8 &, TRequestStatus &)

IMPORT_C voidRead(TDes8 &aDesc,
TRequestStatus &aStatus
)

Parameters

TDes8 & aDesc
TRequestStatus & aStatus

Recv(TDes8 &, TUint, TRequestStatus &)

IMPORT_C voidRecv(TDes8 &aDesc,
TUintflags,
TRequestStatus &aStatus
)

Parameters

TDes8 & aDesc
TUint flags
TRequestStatus & aStatus

Recv(TDes8 &, TUint, TRequestStatus &, TSockXfrLength &)

IMPORT_C voidRecv(TDes8 &aDesc,
TUintflags,
TRequestStatus &aStatus,
TSockXfrLength &aLen
)

Parameters

TDes8 & aDesc
TUint flags
TRequestStatus & aStatus
TSockXfrLength & aLen

RecvFrom(TDes8 &, TSockAddr &, TUint, TRequestStatus &)

IMPORT_C voidRecvFrom(TDes8 &aDesc,
TSockAddr &anAddr,
TUintflags,
TRequestStatus &aStatus
)

Parameters

TDes8 & aDesc
TSockAddr & anAddr
TUint flags
TRequestStatus & aStatus

RecvFrom(TDes8 &, TSockAddr &, TUint, TRequestStatus &, TSockXfrLength &)

IMPORT_C voidRecvFrom(TDes8 &aDesc,
TSockAddr &anAddr,
TUintflags,
TRequestStatus &aStatus,
TSockXfrLength &aLen
)

Parameters

TDes8 & aDesc
TSockAddr & anAddr
TUint flags
TRequestStatus & aStatus
TSockXfrLength & aLen

RecvOneOrMore(TDes8 &, TUint, TRequestStatus &, TSockXfrLength &)

IMPORT_C voidRecvOneOrMore(TDes8 &aDesc,
TUintflags,
TRequestStatus &aStatus,
TSockXfrLength &aLen
)

Parameters

TDes8 & aDesc
TUint flags
TRequestStatus & aStatus
TSockXfrLength & aLen

RecvOneOrMore(TDes8 &, TUint, TRequestStatus &)

IMPORT_C voidRecvOneOrMore(TDes8 &aDesc,
TUintflags,
TRequestStatus &aStatus
)

Parameters

TDes8 & aDesc
TUint flags
TRequestStatus & aStatus

RemoteName(TSockAddr &)

IMPORT_C voidRemoteName(TSockAddr &anAddr)

Parameters

TSockAddr & anAddr

Send(const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C voidSend(const TDesC8 &aDesc,
TUintsomeFlags,
TRequestStatus &aStatus
)

Parameters

const TDesC8 & aDesc
TUint someFlags
TRequestStatus & aStatus

Send(const TDesC8 &, TUint, TRequestStatus &, TSockXfrLength &)

IMPORT_C voidSend(const TDesC8 &aDesc,
TUintsomeFlags,
TRequestStatus &aStatus,
TSockXfrLength &aLen
)

Parameters

const TDesC8 & aDesc
TUint someFlags
TRequestStatus & aStatus
TSockXfrLength & aLen

SendTo(const TDesC8 &, TSockAddr &, TUint, TRequestStatus &)

IMPORT_C voidSendTo(const TDesC8 &aDesc,
TSockAddr &anAddr,
TUintflags,
TRequestStatus &aStatus
)

Parameters

const TDesC8 & aDesc
TSockAddr & anAddr
TUint flags
TRequestStatus & aStatus

SendTo(const TDesC8 &, TSockAddr &, TUint, TRequestStatus &, TSockXfrLength &)

IMPORT_C voidSendTo(const TDesC8 &aDesc,
TSockAddr &anAddr,
TUintflags,
TRequestStatus &aStatus,
TSockXfrLength &aLen
)

Parameters

const TDesC8 & aDesc
TSockAddr & anAddr
TUint flags
TRequestStatus & aStatus
TSockXfrLength & aLen

SetLocalPort(TInt)

IMPORT_C TIntSetLocalPort(TIntaPort)

Parameters

TInt aPort

SetOpt(TUint, TUint, const TDesC8 &)

IMPORT_C TIntSetOpt(TUintanOptionName,
TUintanOptionLevel,
const TDesC8 &anOption =  TPtrC8(NULL, 0)
)

Parameters

TUint anOptionName
TUint anOptionLevel
const TDesC8 & anOption =  TPtrC8(NULL, 0)

SetOpt(TUint, TUint, TInt)

IMPORT_C TIntSetOpt(TUintanOptionName,
TUintanOptionLevel,
TIntanOption
)

Parameters

TUint anOptionName
TUint anOptionLevel
TInt anOption

Shutdown(TShutdown, TRequestStatus &)

IMPORT_C voidShutdown(TShutdownaHow,
TRequestStatus &aStatus
)

Parameters

TShutdown aHow
TRequestStatus & aStatus

Shutdown(TShutdown, const TDesC8 &, TDes8 &, TRequestStatus &)

IMPORT_C voidShutdown(TShutdownaHow,
const TDesC8 &aDisconnectDataOut,
TDes8 &aDisconnectDataIn,
TRequestStatus &aStatus
)

Parameters

TShutdown aHow
const TDesC8 & aDisconnectDataOut
TDes8 & aDisconnectDataIn
TRequestStatus & aStatus

Transfer(RSocketServ &, const TDesC &)

IMPORT_C TIntTransfer(RSocketServ &aServer,
const TDesC &aName
)

Parameters

RSocketServ & aServer
const TDesC & aName

Write(const TDesC8 &, TRequestStatus &)

IMPORT_C voidWrite(const TDesC8 &aDesc,
TRequestStatus &aStatus
)

Parameters

const TDesC8 & aDesc
TRequestStatus & aStatus

Member Enumerations Documentation

Enum TShutdown

Argument to RSocket::Shutdown() specifying how abruptly the shutdown occurs.

Enumerators

ENormal

Complete when socket output/input stopped.

EStopInput

Stop socket input and complete when output is stopped.

EStopOutput

Stop socket output and complete when input is stopped.

EImmediate

Stop socket input/output and complete (abortive close).