|
||
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.
RSubSessionBase
-
Client-side handle to a sub-session.
RCommsSubSession
- (No abstract)
RSocket
- Provides a client endpoint to a protocol. It provides functions for socket creat...
Defined in RSocket
:
Accept(RSocket &,TDes8 &,TRequestStatus &)
Facilitates a client/server connection from a remote socket.Accept(RSocket &,TRequestStatus &)
Facilitates a client/server connection from a remote socket.Bind(TSockAddr &)
Sets the local address of a socket.CancelAccept()
Cancels an outstanding accept operation.CancelAll()
Cancels all outstanding operations.CancelConnect()
Cancels an outstanding connect operation.CancelIoctl()
Cancels an outstanding RSocket::Ioctl(TUint,TRequestStatus &,TDes8 *,TUint) ...CancelRead()
Cancels an outstanding RSocket::Read(TDes8 &,TRequestStatus &) operation...CancelRecv()
Cancels an outstanding RSocket::Recv(TDes8 &,TUint,TRequestStatus &) ope...CancelSend()
Cancels an outstanding RSocket::Send(const TDesC8 &,TUint,TRequestStatus &am...CancelWrite()
Cancels an outstanding RSocket::Write(const TDesC8 &,TRequestStatus &) o...Close()
Closes a socket.Connect(TSockAddr &,TRequestStatus &)
Connects to a remote host asynchronously.Connect(TSockAddr &,const TDesC8 &,TDes8 &,TRequestStatus &)
Connects to a remote host asynchronously.EImmediate
Stop socket input/output and complete (abortive close). 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. GetDisconnectData(TDes8 &)
Gets data for use in the disconnection of a socket, namely the remote name of th...GetOpt(TUint,TUint,TDes8 &)
Gets a socket option. The socket server has options which are generic to all soc...GetOpt(TUint,TUint,TInt &)
Gets a socket option. The socket server has options which are generic to all soc...Info(TProtocolDesc &)
Gets information in the protocol description for the protocol which a socket is ...Ioctl(TUint,TRequestStatus &,TDes8 *,TUint)
Applies an asynchronous I/O control operation on a socket. Data may be passed an...Listen(TUint)
Sets up a socket to listen for incoming connections.Listen(TUint,const TDesC8 &)
Sets up a socket to listen for incoming connections.LocalName(TSockAddr &)
Gets the local address of a bound socket.LocalPort()
Gets the local port number of a bound socket.Name(TName &)
Gets a unique system name for the socket. The purpose of this is to identify the...Open(RSocketServ &)
Opens a socket by creating a new subsession to the socket server.Open(RSocketServ &,TUint,TUint,TUint)
Opens a socket by creating a new subsession to the socket server.Open(RSocketServ &,TUint,TUint,TUint,RConnection &)
Opens a socket which is associated with the same interface as an existing RConne...Open(RSocketServ &,TUint,TUint,TUint,RSubConnection &)
Opens a socket which is associated with and associates it with a RSubConnection.Open(RSocketServ &,const TDesC &)
Opens a socket by creating a new subsession to the socket server.RSocket()
Default Constructor Read(TDes8 &,TRequestStatus &)
Receives data from a remote host.Recv(TDes8 &,TUint,TRequestStatus &)
Receives data from a remote host, allowing flags for protocol specific informati...Recv(TDes8 &,TUint,TRequestStatus &,TSockXfrLength &)
Receives data from a remote host, allowing flags for protocol specific informati...RecvFrom(TDes8 &,TSockAddr &,TUint,TRequestStatus &)
Receives data from a remote host through a (possibly) unconnected socket and ret...RecvFrom(TDes8 &,TSockAddr &,TUint,TRequestStatus &,TSockXfrLength &)
Receives data from a remote host through a (possibly) unconnected socket where a...RecvOneOrMore(TDes8 &,TUint,TRequestStatus &,TSockXfrLength &)
Receives data from a remote host and completes when data is available.RemoteName(TSockAddr &)
Gets the remote name of a connected socket.Send(const TDesC8 &,TUint,TRequestStatus &)
Sends data to a remote host on a connected socket with options set by protocol s...Send(const TDesC8 &,TUint,TRequestStatus &,TSockXfrLength &)
Sends data to a remote host on a connected socket with options set by protocol s...SendTo(const TDesC8 &,TSockAddr &,TUint,TRequestStatus &)
Sends data to a remote host through a (possibly) unconnected socket to a specifi...SendTo(const TDesC8 &,TSockAddr &,TUint,TRequestStatus &,TSockXfrLength &)
Sends data to a remote host through a (possibly) unconnected socket to a specifi...SetLocalPort(TInt)
Sets the local port of a socket. Setting the local port is equivalent to calling...SetOpt(TUint,TUint,TInt)
Sets a socket option. The socket server has options which are generic to all soc...SetOpt(TUint,TUint,const TDesC8 &)
Sets a socket option. The socket server has options which are generic to all soc...Shutdown(TShutdown,TRequestStatus &)
Shuts down a connected socket - asynchronous.Shutdown(TShutdown,const TDesC8 &,TDes8 &,TRequestStatus &)
Shuts down a connected socket with disconnect data - asynchronous.TShutdown
Used in structure TProtocolDesc to describes the endianness of a protocol. Transfer(RSocketServ &,const TDesC &)
Transfers a socket from one socket server session to another. It creates the soc...Write(const TDesC8 &,TRequestStatus &)
Sends data to a remote host.Inherited from RSubSessionBase
:
CloseSubSession(TInt)
Closes the sub-session.CreateAutoCloseSubSession(RSessionBase &,TInt,const TIpcArgs &)
Creates a new sub-session within an existing session. The new sub-session takes ...CreateSubSession(const RSessionBase &,TInt)
Creates a new sub-session within an existing session.CreateSubSession(const RSessionBase &,TInt,const TIpcArgs &)
Creates a new sub-session within an existing session.Send(TInt)const
Sends a blind message to the server - no reply is expected.Send(TInt,const TIpcArgs &)const
Sends a blind message to the server - no reply is expected.SendReceive(TInt)const
Sends a message to the server and waits synchronously for a reply.SendReceive(TInt,TRequestStatus &)const
Sends a message to the server and waits asynchronously for the reply.SendReceive(TInt,const TIpcArgs &)const
Sends a message to the server and waits synchronously for a reply.SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
Sends a message to the server and waits asynchronously for the reply.Session()const
Returns a copy of the session associated with this sub-session.SubSessionHandle()const
Gets the sub-session handle number.Capability: | Dependent | on the type of socket so deferred to PRT |
Capability: | NetworkServices | Conditional on: KProtocolInet6Icmp
|
Capability: | NetworkControl | Conditional on: KProtocolInetIp
|
Capability: | NetworkServices | Conditional on: INET_ADDR
|
Capability: | NetworkServices | Conditional on: KProtocolInetUdp
|
Capability: | NetworkServices | Conditional on: KProtocolInetTcp
|
Capability: | NetworkServices | Conditional on: KProtocolInetIcmp
|
Capability: | NetworkControl | Conditional on: KProtocolInet6Ip
|
IMPORT_C TInt Open(RSocketServ &aServer, TUint addrFamily, TUint sockType, TUint protocol);
Opens a socket by creating a new subsession to the socket server.
Opens a channel to a protocol identified by a tuple of constants. If a socket is the first to be opened for a protocol it will have the additional effect of loading the protocol in the socket server.
NOTE: Deprecated default connection scenario. Applications exercising the default connection scenario must (from 9.3 onwards) switch to explicit connection scenario.
The default connection scenario is where an application holding one started RConnection
opens a socket without explicitly associating it with the RConnection
. The explicit association can be made by passing the RConnection
or a derived RSubConnection
to an appropriate overload of RSocket::Open(RSocketServ &,TUint,TUint,TUint)
(...) (not this method).
The implicit connection scenario is where an application holding either none or many started RConnections (to different access
points) opens a socket without explicitly associating it an RConnection
.
The explicit connection scenario is where an application holding started RConnections opens a socket explicitly associating it with one of its RConnections.
Applications attempting to exercise the default connection scenario shall (from 9.3 onwards) receive an error from RSocket::Open(RSocketServ &,TUint,TUint,TUint)
(...). The actual error code is yet to be defined.
|
|
Capability: | Dependent | on the type of connection so deferred to PRT |
IMPORT_C TInt Open(RSocketServ &aServer, TUint addrFamily, TUint sockType, TUint protocol, RConnection &aConnection);
Opens a socket which is associated with the same interface as an existing RConnection
.
Note: The association is instantaneous, in that the socket is associated with the interface that the RConnection
is associated with at the present time. This association terminates when the underlying interface goes down.
|
|
Capability: | Dependent | on the type of connection so deferred to PRT |
IMPORT_C TInt Open(RSocketServ &aServer, TUint addrFamily, TUint sockType, TUint protocol, RSubConnection &aSubConnection);
Opens a socket which is associated with and associates it with a RSubConnection
.
|
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C TInt Open(RSocketServ &aServer, const TDesC &aName);
Opens a socket by creating a new subsession to the socket server.
Opens a channel to a protocol identified by a name. If a socket is the first to be opened for a protocol it will have the additional effect of loading the protocol in the socket server.
NOTE: Deprecated default connection scenario. Applications exercising the default connection scenario must (from 9.3 onwards) switch to explicit connection scenario.
The default connection scenario is where an application holding one started RConnection
opens a socket without explicitly associating it with the RConnection
. The explicit association can be made by passing the RConnection
or a derived RSubConnection
to an appropriate overload of RSocket::Open(RSocketServ &,TUint,TUint,TUint)
(...) (not this method).
The implicit connection scenario is where an application holding either none or many started RConnections (to different access
points) opens a socket without explicitly associating it an RConnection
.
The explicit connection scenario is where an application holding started RConnections opens a socket explicitly associating it with one of its RConnections.
Applications attempting to exercise the default connection scenario shall (from 9.3 onwards) receive an error from RSocket::Open(RSocketServ &,TUint,TUint,TUint)
(...). The actual error code is yet to be defined.
|
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C TInt Open(RSocketServ &aServer);
Opens a socket by creating a new subsession to the socket server.
Provides a blank channel to the socket server which has no protocol associated. A socket opened in this manner is suitable
as an argument to RSocket::Accept(RSocket &,TRequestStatus &)
, which will marry the blank socket to a protocol when a connection is established to a remote endpoint.
|
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Send(const TDesC8 &aDesc, TUint someFlags, TRequestStatus &aStatus);
Sends data to a remote host on a connected socket with options set by protocol specific flags.
A socket may only have one send operation in progress at any one time. RSocket::Send(const TDesC8 &,TUint,TRequestStatus &)
should only be used with connected sockets.
If a protocol's information flag is marked with KSIUrgentData, then KSockWriteUrgent may be provided as a flag to RSocket::Send(const TDesC8 &,TUint,TRequestStatus &)
. All other flags are protocol specific.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Send(const TDesC8 &aDesc, TUint someFlags, TRequestStatus &aStatus, TSockXfrLength &aLen);
Sends data to a remote host on a connected socket with options set by protocol specific flags.
The length of the descriptor indicates the amount of data to be sent. The TSockXfrLength argument will return the amount of data actually sent.
A socket may only have one send operation in progress at any one time.
RSocket::Send(const TDesC8 &,TUint,TRequestStatus &)
should only be used with connected sockets.
If a protocol's information flag is marked with KSIUrgentData, then KSockWriteUrgent may be provided as a flag to RSocket::Send(const TDesC8 &,TUint,TRequestStatus &)
. All other flags are protocol specific.
|
IMPORT_C void CancelSend();
Cancels an outstanding RSocket::Send(const TDesC8 &,TUint,TRequestStatus &)
operation.
Calling the function will cause any outstanding send operation to complete prematurely. The state of a socket after a send is cancelled is defined by the characteristics of the protocol.
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Recv(TDes8 &aDesc, TUint flags, TRequestStatus &aStatus);
Receives data from a remote host, allowing flags for protocol specific information.
For a stream-interfaced socket the function only completes when the full amount of requested data has been received (or the connection breaks). This means when the descriptor has been filled to its maximum length (not its current length).
For a datagram-interface socket, the function completes when one datagram arrives - even if it is not sufficient to fill the buffer. If the datagram does not fit in the buffer supplied then the remaining data will be lost.
RSocket::Recv(TDes8 &,TUint,TRequestStatus &)
should only be used with connected sockets.
A socket may only have one receive operation outstanding at any one time.
If a protocol's information flag is marked with KSIPeekData, then KSockReadPeek may be provided as a flag to RSocket::Recv(TDes8 &,TUint,TRequestStatus &)
. All other flags are protocol specific.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Recv(TDes8 &aDesc, TUint flags, TRequestStatus &aStatus, TSockXfrLength &aLen);
Receives data from a remote host, allowing flags for protocol specific information.
For a stream-interfaced sockets, the function only completes when the full amount of requested data has been received (or the connection breaks). This means when the descriptor has been filled to its maximum length (not its current length).
For a datagram-interface socket, the function completes when one datagram arrives - even if it is not sufficient to fill the buffer. If the datagram does not fit in the buffer supplied then the remaining data will be lost.
RSocket::Recv(TDes8 &,TUint,TRequestStatus &)
should only be used with connected sockets.
A socket may only have one receive operation outstanding at any one time.
If a protocol's information flag is marked with KSIPeekData, then KSockReadPeek may be provided as a flag to RSocket::Recv(TDes8 &,TUint,TRequestStatus &)
. All other flags are protocol specific.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void RecvOneOrMore(TDes8 &aDesc, TUint flags, TRequestStatus &aStatus, TSockXfrLength &aLen);
Receives data from a remote host and completes when data is available.
The function reads at least one byte of data, but will complete as soon as any data is available. The amount of data received is returned via the TSockXfrLength argument.
RSocket::RecvOneOrMore(TDes8 &,TUint,TRequestStatus &,TSockXfrLength &)
can only be used with stream-interfaced connected sockets; datagram interface sockets will return KErrNotSupported.
A socket may only have one receive operation outstanding at any one time.
|
IMPORT_C void CancelRecv();
Cancels an outstanding RSocket::Recv(TDes8 &,TUint,TRequestStatus &)
operation.
Calling this function will cause any outstanding receive operation to complete prematurely. The state of a socket after a receive is cancelled is defined by the characteristics of the protocol.
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Read(TDes8 &aDesc, TRequestStatus &aStatus);
Receives data from a remote host.
For a stream-interfaced sockets, the function only completes when the full amount of requested data has been received (or the connection breaks). This means when the descriptor has been filled to its maximum length (not its current length). For a connection-oriented datagram-interface, the function completes when a datagram arrives even if it is not sufficient to fill the buffer.
RSocket::Read(TDes8 &,TRequestStatus &)
should only be used with connected sockets.
A socket may only have one receive operation outstanding at any one time.
|
IMPORT_C void CancelRead();
Cancels an outstanding RSocket::Read(TDes8 &,TRequestStatus &)
operation.
Calling this function will cause any outstanding RSocket::Read(TDes8 &,TRequestStatus &)
operation to complete prematurely. The state of a socket after a receive is cancelled is defined by the characteristics of
the protocol.
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Write(const TDesC8 &aDesc, TRequestStatus &aStatus);
Sends data to a remote host.
RSocket::Write(const TDesC8 &,TRequestStatus &)
should only be used with connected sockets.
|
IMPORT_C void CancelWrite();
Cancels an outstanding RSocket::Write(const TDesC8 &,TRequestStatus &)
operation.
Calling the function will cause any outstanding RSocket::Write(const TDesC8 &,TRequestStatus &)
operation to complete prematurely. The state of a socket after a send is cancelled is defined by the characteristics of the
protocol.
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void SendTo(const TDesC8 &aDesc, TSockAddr &anAddr, TUint flags, TRequestStatus &aStatus);
Sends data to a remote host through a (possibly) unconnected socket to a specified destination address.
Flags are provided to add protocol specific information. The length of the descriptor indicates the amount of data to be sent. A socket may only have one send operation in progress at any one time.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void SendTo(const TDesC8 &aDesc, TSockAddr &anAddr, TUint flags, TRequestStatus &aStatus, TSockXfrLength &aLen);
Sends data to a remote host through a (possibly) unconnected socket to a specified destination address.
Flags are provided to add protocol specific information. The length of the descriptor indicates the amount of data to be sent. A socket may only have one send operation in progress at any one time. The TSockXfrLength argument will return the amount of data sent.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void RecvFrom(TDes8 &aDesc, TSockAddr &anAddr, TUint flags, TRequestStatus &aStatus);
Receives data from a remote host through a (possibly) unconnected socket and returns a source address.
Flags are provided to add protocol specific information.
A socket may only have one receive operation outstanding at any one time.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void RecvFrom(TDes8 &aDesc, TSockAddr &anAddr, TUint flags, TRequestStatus &aStatus, TSockXfrLength &aLen);
Receives data from a remote host through a (possibly) unconnected socket where a source address is returned.
Flags are provided to add protocol specific information.
A socket may only have one receive operation outstanding at any one time.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Connect(TSockAddr &anAddr, TRequestStatus &aStatus);
Connects to a remote host asynchronously.
The address provided specifies the address of the remote host.
A socket may only have one connect operation outstanding at any one time. Once the connect is completed, the socket is ready
to send or receive data. If a socket is unbound - i.e. RSocket::Bind(TSockAddr &)
has not been called yet - then it will automatically have a local address allocated.
RSocket::Connect(TSockAddr &,TRequestStatus &)
is always required for protocols which do not have the KSIConnectionLess flag in their protocol information. If a protocol
has the KSIConnectionLess flag, then RSocket::Connect(TSockAddr &,TRequestStatus &)
may be used to set the address for all data sent from the socket, in which case RSocket::Send(const TDesC8 &,TUint,TRequestStatus &)
/Write() may be used in addition to RSocket::SendTo(const TDesC8 &,TSockAddr &,TUint,TRequestStatus &)
.
To use data in connection a protocol must have the flag KSIConnectData in its protocol information.
To cancel a connect use RSocket::CancelConnect()
.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Connect(TSockAddr &anAddr, const TDesC8 &aConnectDataOut, TDes8 &aConnectDataIn, TRequestStatus &aStatus);
Connects to a remote host asynchronously.
The address provided specifies the address of the remote host.
Some protocols allow data to be sent in connect request packets which may be provided in the data-out descriptor. Some protocols may allow data to be sent in connect responses which may be collected in the data-in descriptor.
A socket may only have one connect operation outstanding at any one time. Once the connect is completed, the socket is ready
to send or receive data. If a socket is unbound - i.e. RSocket::Bind(TSockAddr &)
has not been called yet - then it will automatically have a local address allocated.
RSocket::Connect(TSockAddr &,TRequestStatus &)
is always required for protocols which do not have the KSIConnectionLess flag in their protocol information. If a protocol
has the KSIConnectionLess flag, then RSocket::Connect(TSockAddr &,TRequestStatus &)
may be used to set the address for all data sent from the socket, in which case RSocket::Send(const TDesC8 &,TUint,TRequestStatus &)
/Write() may be used in addition to RSocket::SendTo(const TDesC8 &,TSockAddr &,TUint,TRequestStatus &)
.
To use data in connection a protocol must have the flag KSIConnectData in its protocol information.
To cancel a connect use RSocket::CancelConnect()
.
|
|
IMPORT_C void CancelConnect();
Cancels an outstanding connect operation.
Will cause any outstanding connect operation to complete prematurely.
The state of a socket after a connect is cancelled is defined by the characteristics of the protocol.
IMPORT_C TInt Bind(TSockAddr &anAddr);
Sets the local address of a socket.
When a socket is opened it has no name associated with it, and binding is required so data can be routed to the socket.
RSocket::Bind(TSockAddr &)
should be called before RSocket::Listen(TUint)
or RSocket::Connect(TSockAddr &,TRequestStatus &)
. The address supplied should be a derived class specific to the particular protocol the socket was opened on.
|
|
IMPORT_C TInt SetLocalPort(TInt aPort);
Sets the local port of a socket. Setting the local port is equivalent to calling RSocket::Bind(TSockAddr &)
with only the port set in the address.
|
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Accept(RSocket &aBlankSocket, TRequestStatus &aStatus);
Facilitates a client/server connection from a remote socket.
Extracts the first pending connection on a queue of sockets, the queue size being previously specified by RSocket::Listen(TUint)
. On successful completion the blank socket is given the handle of the new socket and it may then be used to transfer data.
After completion the accept socket may be used to make further connections with new blank sockets (see RSocket::Open(RSocketServ &,TUint,TUint,TUint)
on how to open a blank socket).
RSocket::Accept(RSocket &,TRequestStatus &)
may be used for protocols which do not have the KSIConnectionLess flag in their protocol information.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Accept(RSocket &aBlankSocket, TDes8 &aConnectData, TRequestStatus &aStatus);
Facilitates a client/server connection from a remote socket.
Extracts the first pending connection on a queue of sockets, the queue size being previously specified by RSocket::Listen(TUint)
. On successful completion the blank socket is given the handle of the new socket and it may then be used to transfer data.
After completion the accept socket may be used to make further connections with new blank sockets (see RSocket::Open(RSocketServ &,TUint,TUint,TUint)
on how to open a blank socket).
This variant provides an additional descriptor argument to receive data which may have been sent in a connect request. If
there is a pending connection in the listen queue when RSocket::Accept(RSocket &,TRequestStatus &)
is called, the call will complete immediately. Otherwise it will wait until a socket becomes available in the queue and complete
asynchronously.
RSocket::Accept(RSocket &,TRequestStatus &)
may be used for protocols which do not have the KSIConnectionLess flag in their protocol information.
To receive data-in accepting, a protocol must have the flag KSIConnectData in its protocol information.
|
IMPORT_C void CancelAccept();
Cancels an outstanding accept operation.
Will cause any outstanding accept operation to complete prematurely.
IMPORT_C TInt Listen(TUint qSize);
Sets up a socket to listen for incoming connections.
Before calling this procedure a socket should be opened on a specific protocol using RSocket::Open(RSocketServ &,TUint,TUint,TUint)
and the socket should be bound to a local address using RSocket::Bind(TSockAddr &)
.
RSocket::Listen(TUint)
creates a queue to hold incoming connections which can be married with blank sockets using RSocket::Accept(RSocket &,TRequestStatus &)
. The call also allows data to be sent back to connecting peers if a protocol allows data to be passed in connect responses.
Once a listen queue has been created it will continue to allow peers to connect until it is full, at which point it will reject
any incoming connections as specified by protocol behaviour. When a socket is accepted by the client a space is made available
in the queue.
|
|
IMPORT_C TInt Listen(TUint qSize, const TDesC8 &aConnectData);
Sets up a socket to listen for incoming connections.
Before calling this procedure a socket should be opened on a specific protocol using RSocket::Open(RSocketServ &,TUint,TUint,TUint)
and the socket should be bound to a local address using RSocket::Bind(TSockAddr &)
.
RSocket::Listen(TUint)
creates a queue to hold incoming connections which can be married with blank sockets using RSocket::Accept(RSocket &,TRequestStatus &)
. The call also allows data to be sent back to connecting peers if a protocol allows data to be passed in connect responses.
Once a listen queue has been created it will continue to allow peers to connect until it is full, at which point it will reject
any incoming connections as specified by protocol behaviour. When a socket is accepted by the client a space is made available
in the queue.
To use data-in listening, a protocol must have the flag KSIConnectData in its protocol information.
|
|
Capability: | Dependent | on the type of operation so deferred to PRT. See documentation of constant values used in aOptionName and aOptionLevel for more information |
Capability: | Illegal - Unknown capability "ECapabilityNetworkControl" | Conditional on: KSoIpv4LinkLocal
|
Capability: | NetworkControl | Conditional on: KSoInetStartInterface
|
Capability: | NetworkControl | Conditional on: KSoInetChangeRoute
|
Capability: | NetworkControl | Conditional on: KSoInetDeleteInterface
|
Capability: | NetworkControl | Conditional on: KSoInetConfigInterface
|
Capability: | NetworkControl | Conditional on: KSoInetCreateIPv4LLOnInterface
|
Capability: | NetworkControl | Conditional on: KSoInetResetInterface
|
Capability: | NetworkControl | Conditional on: KSoInetChangeInterface
|
Capability: | NetworkControl | Conditional on: KSoInetDeleteRoute
|
Capability: | NetworkControl | Conditional on: KSoInetAddRoute
|
IMPORT_C TInt SetOpt(TUint anOptionName, TUint anOptionLevel, const TDesC8 &anOption=TPtrC8(0,0));
Sets a socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be set with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
Capability: | Dependent | on the type of operation so deferred to PRT. See documentation of constant values used in aOptionName and aOptionLevel for more information |
IMPORT_C TInt SetOpt(TUint anOptionName, TUint anOptionLevel, TInt anOption);
Sets a socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be set with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
Capability: | Dependent | on the type of operation so deferred to PRT. See documentation of constant values used in aOptionName and aOptionLevel for more information |
IMPORT_C TInt GetOpt(TUint anOptionName, TUint anOptionLevel, TDes8 &anOption);
Gets a socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be got with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
Capability: | Dependent | on the type of operation so deferred to PRT. See documentation of constant values used in aOptionName and aOptionLevel for more information |
IMPORT_C TInt GetOpt(TUint anOptionName, TUint anOptionLevel, TInt &anOption);
Gets a socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be got with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
Capability: | Dependent | on the type of operation so deferred to PRT. See documentation of constant values used in aOptionName and aOptionLevel for more information |
IMPORT_C void Ioctl(TUint aCommand, TRequestStatus &aStatus, TDes8 *aDesc=0,TUint aLevel=KLevelUnspecified);
Applies an asynchronous I/O control operation on a socket. Data may be passed and received if a descriptor address is provided
as an argument. Only one RSocket::Ioctl(TUint,TRequestStatus &,TDes8 *,TUint)
operation may be outstanding for each socket.
Commands available for all protocols can be set withaLevel set to KSOLSocket. See individual protocol notes for other commands.
|
IMPORT_C void CancelIoctl();
Cancels an outstanding RSocket::Ioctl(TUint,TRequestStatus &,TDes8 *,TUint)
operation.
Will cause any outstanding Ioctl operation to complete prematurely.
The state of a socket after a connect is cancelled is defined by the characteristics of the protocol.
IMPORT_C TInt GetDisconnectData(TDes8 &aDesc);
Gets data for use in the disconnection of a socket, namely the remote name of the connected socket.
This data has been received in a protocol disconnect message.
To use the data in disconnection, a protocol must have the flagKSIConnectData in its protocol information.
|
|
IMPORT_C void LocalName(TSockAddr &anAddr);
Gets the local address of a bound socket.
The local address is set either by calling RSocket::Bind(TSockAddr &)
, or is automatically set when RSocket::Connect(TSockAddr &,TRequestStatus &)
is called.
If a socket is created through RSocket::Accept(RSocket &,TRequestStatus &)
then a socket will inherit the port of its parent unless otherwise specified by a protocol's behaviour.
Depending on a protocol implementation, additional information may be gained through this call.
|
IMPORT_C TUint LocalPort();
Gets the local port number of a bound socket.
Getting the local port is similar to getting the local name.
|
RSocket::LocalName(TSockAddr &)
Gets the local address of a bound socket.IMPORT_C void RemoteName(TSockAddr &anAddr);
Gets the remote name of a connected socket.
The remote name of a socket is associated with the remote host a socket is connected to. The remote name is only valid for
a connected socket. A socket is either connected through calling RSocket::Connect(TSockAddr &,TRequestStatus &)
or RSocket::Accept(RSocket &,TRequestStatus &)
.
|
IMPORT_C void Close();
Closes a socket.
If a socket has been opened using RSocket::Open(RSocketServ &,TUint,TUint,TUint)
then it should be closed using RSocket::Close()
. This will ensure all associated resources are released.
Closing serves two distinct purposes:
To release resources associated with the IPC channel to the socket server.
To disconnect a socket if it is connected.
If a socket is connected, then calling close is equivalent to calling RSocket::Shutdown(TShutdown,TRequestStatus &)
with an argument of RSocket::ENormal
, synchronously waiting for the request to complete, and then closing the IPC channel. If asynchronous or alternative methods
of disconnecting are required then RSocket::Shutdown(TShutdown,TRequestStatus &)
should be called before RSocket::Close()
.
If the RSocketServ
session on which a protocol was opened is closed, then all sockets associated with that session will be abortively closed
and any further requests on the sockets will result in panics.
If a protocol has the flag KSIGracefulClose in its protocol information, when RSocket::Close()
is called on a connected socket, the socket will synchronously block until a response to a close request has been received
or some other protocol condition causes the call to complete.
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Shutdown(TShutdown aHow, TRequestStatus &aStatus);
Shuts down a connected socket - asynchronous.
This method is asynchronous as non emergency shutdown may take a while.
The shut down method allows input and output to be individually stopped for a protocol endpoint. For protocols which support data-in disconnect message, additional arguments are provided.
RSocket::Shutdown(TShutdown,TRequestStatus &)
can be used for protocols which do not have the KSIConnectionLess flag in their protocol information.
To use data in disconnection a protocol must have the flag KSIDisconnectData in its protocol information.
There is no way to cancel a socket shutdown once it has started.
|
Capability: | Dependent | on the type of socket so deferred to PRT |
IMPORT_C void Shutdown(TShutdown aHow, const TDesC8 &aDisconnectDataOut, TDes8 &aDisconnectDataIn, TRequestStatus &aStatus);
Shuts down a connected socket with disconnect data - asynchronous.
This method is asynchronous as non emergency shutdown may take a while.
The shut down method allows input and output to be individually stopped for a protocol endpoint. For protocols which support data-in disconnect message, additional arguments are provided.
RSocket::Shutdown(TShutdown,TRequestStatus &)
can be used for protocols which do not have the KSIConnectionLess flag in their protocol information.
To use data in disconnection a protocol must have the flag KSIConnectData in its protocol information.
There is no way to cancel a socket shutdown once it has started.
|
IMPORT_C void CancelAll();
Cancels all outstanding operations.
Will cause all outstanding operations to complete prematurely.
Outstanding operations for a socket include: read, write, Ioctl, connect, accept and shutdown. All of these operations will be completed by this call.
IMPORT_C TInt Info(TProtocolDesc &aProtocol);
Gets information in the protocol description for the protocol which a socket is opened on.
|
|
IMPORT_C TInt Name(TName &aName);
Gets a unique system name for the socket. The purpose of this is to identify the socket in a call to RSocket::Transfer(RSocketServ &,const TDesC &)
.
|
|
Capability: | Dependent | on the capabilities defined in the setOpt by the source Socket |
IMPORT_C TInt Transfer(RSocketServ &aServer, const TDesC &aName);
Transfers a socket from one socket server session to another. It creates the socket in the target session, and removes the socket from the source session. The call is made on an uninitialised RSocket object. The socket system name is used to identify the socket to transfer.
If the call fails, the socket that is being transferred remains with the original session. Success or failure can be checked
on the originating socket by calling RSocket::Info(TProtocolDesc &)
, which returns KErrNone if the transfer failed, and KErrBadHandle if it succeeded.
Platsec considerations require that the source socket must set itself transferable before any attempt to transfer the socket to the destination socket. This is done using a setopt in the following way
_LIT_SECURITY_POLICY_Cn(KProcPolicy, cap1,cap2,...capn);
ret = destsock.SetOpt(KSOEnableTransfer, KSOLSocket, KProcPolicy().Package());
where cap1,cap2...capn are the capabilities that the destination process MUST have in order to affect the transfer.
An example is:
_LIT_SECURITY_POLICY_C2(KProcPolicy, ECapabilityNetworkServices, ECapabilityNetworkControl);
ret = destsock.SetOpt(KSOEnableTransfer, KSOLSocket, KProcPolicy().Package());
If the setOpt is not set or the destination process does not have sufficient capabilities then the function will return KErrPermissionDenied
|
|
TShutdown
Used in structure TProtocolDesc
to describes the endianness of a protocol.
|