Symbian3/PDK/Source/GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB" xml:lang="en"><title> Connecting
       
    13 and Disconnecting a Remote Host Tutorial</title><shortdesc>This topic describes how to connect and disconnect a remote host. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 
       
    15 <section><title>Introduction</title><p>To send and receive the data packets,
       
    16 a connection must be established with a remote host. This tutorial describes
       
    17 the following: </p><ul>
       
    18 <li><p> <xref href="GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita#GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB/GUID-E832AD84-7441-5AC2-9884-AAC0C736CCBE">How
       
    19 to Connect to a Remote Host</xref>  </p> </li>
       
    20 <li><p>  <xref href="GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita#GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB/GUID-A1FD6397-0110-50FE-89E2-CB0734FD5D22">How
       
    21 to Disconnect from a Remote Host</xref>  </p> </li>
       
    22 <li><p>  <xref href="GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita#GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB/GUID-D1876052-357C-5D1B-AC2D-23536CC60FF6">How
       
    23 to Listen to a Connect Request</xref> </p> </li>
       
    24 <li><p>  <xref href="GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita#GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB/GUID-90E124C2-4B2C-51FE-AF07-923853C617B7">How
       
    25 to Accept a Connect Request</xref>  </p> </li>
       
    26 <li><p>  <xref href="GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB.dita#GUID-182A7A60-80BD-5E54-917A-8F4C26BB94CB/GUID-7727C0A0-5D80-5325-991E-0BA627B1356C">How
       
    27 to Shut down a Connection</xref>  </p> </li>
       
    28 </ul> </section>
       
    29 <section><title>How
       
    30 to Connect to a Remote Host</title><p>The high level steps to connect to a
       
    31 remote host are as follows:</p> <ol id="GUID-46E4E5C3-E121-5B53-8E52-E00C6FE664AB">
       
    32 <li id="GUID-84078269-543D-533E-B0C8-F571AFD0B049"><p>The <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-AC5A49E9-337D-334A-9CD0-DB8226372306"><apiname>RSocket::Connect()</apiname></xref> function
       
    33 connects to a remote host. The <codeph>RSocket::Connect()</codeph> parameters
       
    34 identifies the required type of socket connection. For more information, see <xref href="GUID-B8DEA3EE-7BA7-5A29-9A27-B87EE0EB254F.dita#GUID-B8DEA3EE-7BA7-5A29-9A27-B87EE0EB254F/GUID-EB1C5A5A-E40C-559B-82E9-D19F8E4F4B49">important
       
    35 parameters</xref> . </p> <p>For TCP sockets </p> <ol id="GUID-FCF6E01D-A632-595C-A79C-A17D13A9EE63">
       
    36 <li id="GUID-D10BD1B0-549C-5766-B81E-D5B88B2C9F9F"><p>An active connection
       
    37 is made to the remote host. When the socket call completes successfully, the
       
    38 socket can send and receive data. To create a connection, the protocol must
       
    39 establish a network interface and a route to the destination. For more information
       
    40 about this process and return values, see the <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-AC5A49E9-337D-334A-9CD0-DB8226372306"><apiname>RSocket::Connect()</apiname></xref> function. </p> </li>
       
    41 </ol> </li>
       
    42 <li id="GUID-37CC6747-BC8D-5C6E-8358-4EEEB5BC90C8"><p>For UDP </p> <ol id="GUID-1D9019A5-43C9-5D62-ABBC-8589472D24A1">
       
    43 <li id="GUID-54B60EA0-F3B1-5261-B795-E67A8D616C93"><p>UDP is a connectionless
       
    44 protocol which means the <codeph>RSocket::Connect()</codeph> does not have
       
    45 to be called before writing data with <codeph>RSocket::SendTo()</codeph>.
       
    46 It can be used to set the address for all data sent from the socket. In this
       
    47 case, <codeph>Send()/Write()</codeph> function can be used in addition to <codeph>SendTo()</codeph> function. </p> </li>
       
    48 </ol> </li>
       
    49 </ol><title>How to Disconnect from a Remote Host</title><p> For cancelling
       
    50 the connection  </p><p> The <codeph>RSocket::CancelConnect()</codeph> function
       
    51 cancels the outstanding connect operation with a remote host. This function
       
    52 also cancels any outstanding <codeph>RSocket::Ioctl()</codeph> calls. After
       
    53 this call, a socket can be reconnected by <codeph>RSocket::Connect()</codeph> function.
       
    54  </p><title>How to Listen to a Connect Request</title><p> A TCP socket can
       
    55 be set to listen with <codeph>RSocket::Listen()</codeph>. The <codeph>aDataOut</codeph> argument
       
    56 is ignored.  </p><title>How to Accept a Connect Request</title><p> A connection
       
    57 request to a listening socket can be accepted with <codeph>RSocket::Accept()</codeph>.
       
    58 An <codeph>aConnectData</codeph> argument cannot be specified.  </p><title>How
       
    59 to Shut down a Connection</title><p> Use <codeph>RSocket::Shutdown()</codeph> to
       
    60 asynchronously shut down a TCP. Disconnection data is not supported.  </p><p> The
       
    61 following table describes the effects of different types of shut down for
       
    62 TCP:  </p><table id="GUID-278A0CA9-6C8E-4909-9D69-4535C025C51D">
       
    63 <tgroup cols="2"><colspec colname="col1"/><colspec colname="col2"/>
       
    64 <tbody>
       
    65 <row>
       
    66 <entry><b>Type</b></entry>
       
    67 <entry><b>Action</b></entry>
       
    68 </row>
       
    69 <row>
       
    70 <entry><codeph>ENormal</codeph></entry>
       
    71 <entry>Blocked reads and writes are terminated. No further data is accepted
       
    72 from the remote source and TCP disconnect is initiated. </entry>
       
    73 </row>
       
    74 <row>
       
    75 <entry><codeph>EStopInput</codeph></entry>
       
    76 <entry>Blocked reads are terminated. No further data is accepted from the
       
    77 remote source.</entry>
       
    78 </row>
       
    79 <row>
       
    80 <entry><codeph>EStopOutput</codeph></entry>
       
    81 <entry>Blocked writes are terminated. TCP disconnect is initiated.</entry>
       
    82 </row>
       
    83 <row>
       
    84 <entry><codeph>Eimmediate</codeph></entry>
       
    85 <entry>Blocked reads and writes are terminated. The connection is terminated
       
    86 by sending a reset.</entry>
       
    87 </row>
       
    88 </tbody>
       
    89 </tgroup>
       
    90 </table> </section>
       
    91 </conbody></concept>