Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to connect and disconnect


Connecting to a remote host

A connection to a remote host is made with RSocket::Connect().


TCP

For TCP sockets, an active connection is made to the remote host. When the socket call completes successfully, the socket is ready to send and receive data. To form a connection, the protocol must establish a network interface and a route to the destination. For details of this process, and further return values for RSocket::Connect().


UDP

As UDP is a connectionless protocol, Connect() does not have to be called before writing data with RSocket::SendTo(). It can be used to set the address for all data sent from the socket, in which case Send()/Write() may be used in addition to SendTo().

[Top]


Cancelling a connection

Cancel an outstanding connect operation to a remote host with RSocket::CancelConnect(). The call also cancels any outstanding RSocket::Ioctl() calls.

After this call, a socket can be reconnected by RSocket::Connect().

[Top]


Listening and accepting connect requests


Listening

A TCP socket can be set to listen with RSocket::Listen(). The aDataOut argument is ignored.


Accepting connect requests

A connection request to a listening socket can be accepted with RSocket::Accept(). A aConnectData argument cannot be specified.

[Top]


Shutting down a connection

Use RSocket::Shutdown() to asynchronously shut down a TCP. Disconnection data is not supported.

The following table describes the effects of different types of shut down for TCP:

Type

Action

ENormal

Blocked reads and writes are terminated. No further data is accepted from the remote source, and TCP disconnect is initiated.

EStopInput

Blocked reads are terminated. No further data is accepted from the remote source.

EStopOutput

Blocked writes are terminated. TCP disconnect is initiated.

Eimmediate

Blocked reads and writes are terminated.

The connection is terminated by sending a reset.