Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-7EE80A94-DAB3-5A5C-B3AE-146501592736"><title>Sending and Receiving Data Tutorial</title><shortdesc>This topic describes how to send and receive data to a remote host. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>Introduction</title> <p>When the client connects to the remote host it can send and receive data packets to a remote host. This tutorial describes the following: </p> <ul><li id="GUID-BED45529-EC0D-5A52-815A-CB56B2995842"><p> <xref href="GUID-7EE80A94-DAB3-5A5C-B3AE-146501592736.dita#GUID-7EE80A94-DAB3-5A5C-B3AE-146501592736/GUID-9E7CB558-F1AC-5C65-906B-2BF97FDD8124"> How to Send Data to a Remote Host</xref> </p> </li> <li id="GUID-47320BA5-127C-5377-B7A5-105F361FA67D"><p> <xref href="GUID-7EE80A94-DAB3-5A5C-B3AE-146501592736.dita#GUID-7EE80A94-DAB3-5A5C-B3AE-146501592736/GUID-5B79C047-6443-5FA3-9A09-427C88468681"> How to Receive Data from a Remote Host</xref> </p> </li> </ul> </section> <section id="GUID-9E7CB558-F1AC-5C65-906B-2BF97FDD8124"><title> How to Send Data to a Remote Host</title> <p>The <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-ADE2383D-3075-30B4-8F63-6D837EB75AEF"><apiname>RSocket::Send()</apiname></xref> and <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-F948E0A6-DC1A-3FCD-A391-0FEE0F673D36"><apiname>RSocket::SendTo()</apiname></xref> functions send the data to a remote host with a flag parameter option set. </p> </section> <section id="GUID-5B79C047-6443-5FA3-9A09-427C88468681"><title> How to Receive Data from a Remote Host</title> <p>The <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-E17C2B37-BA28-3B7F-9FAC-82D3D2B7B0EF"><apiname>RSocket::Recv()</apiname></xref>, <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-67604D2C-36A6-3586-A31F-FB49C531E66F"><apiname>RSocket::Read()</apiname></xref>, <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-358DD8F2-DEDF-383B-B4F0-11AB5FB1AC72"><apiname>RSocket::RecvOneOrMore()</apiname></xref> and <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-876863C1-E691-3C3F-9CFB-9597B577509E"><apiname>RSocket::RecvFrom()</apiname></xref> functions receive and read the data from a remote host. </p> <p>The <codeph>RSocket::Recv()</codeph> and <codeph>RSocket::Read()</codeph> functions attempts to read the amount of data set by the size of the descriptor passed. These functions only complete when the descriptor is filled, or when the connection closes. If the descriptor is filled, the amount of data read is passed back in <codeph>aLen</codeph>. If the connection closes, the descriptor does not contain any data, and <codeph>aLen</codeph> should be ignored. </p> <p>The <codeph>RSocket::RecvOneOrMore()</codeph> function is completed when data is available. </p> <p>The <codeph>RSocket::RecvFrom()</codeph> function reads the first queued datagram. When it returns <codeph>anAddr</codeph> points to a <codeph>TInetAddr</codeph> object that holds the address of the remote source of the data. In UDP, if the socket is not bound to a local address and port, then binding is attempted. </p> <p> </p> </section> </conbody></concept>