diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,91 @@ + + + + + + Connecting +and Disconnecting a Remote Host TutorialThis topic describes how to connect and disconnect a remote host. + +
Introduction

To send and receive the data packets, +a connection must be established with a remote host. This tutorial describes +the following:

    +
  • How +to Connect to a Remote Host

  • +
  • How +to Disconnect from a Remote Host

  • +
  • How +to Listen to a Connect Request

  • +
  • How +to Accept a Connect Request

  • +
  • How +to Shut down a Connection

  • +
+
How +to Connect to a Remote Host

The high level steps to connect to a +remote host are as follows:

    +
  1. The RSocket::Connect() function +connects to a remote host. The RSocket::Connect() parameters +identifies the required type of socket connection. For more information, see important +parameters .

    For TCP sockets

      +
    1. An active connection +is made to the remote host. When the socket call completes successfully, the +socket can send and receive data. To create a connection, the protocol must +establish a network interface and a route to the destination. For more information +about this process and return values, see the RSocket::Connect() function.

    2. +
  2. +
  3. For UDP

      +
    1. UDP is a connectionless +protocol which means the RSocket::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 this +case, Send()/Write() function can be used in addition to SendTo() function.

    2. +
  4. +
How to Disconnect from a Remote Host

For cancelling +the connection

The RSocket::CancelConnect() function +cancels the outstanding connect operation with a remote host. This function +also cancels any outstanding RSocket::Ioctl() calls. After +this call, a socket can be reconnected by RSocket::Connect() function. +

How to Listen to a Connect Request

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

How to Accept a Connect Request

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

How +to Shut 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. + + + +
+
\ No newline at end of file