diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-8E158109-AE22-5216-90E8-63A4BD4CC90B.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-8E158109-AE22-5216-90E8-63A4BD4CC90B.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,107 @@ + + + + + + Opening +a Socket Server connection: TutorialThis tutorial describes how an application can open and manage +a connection to the Socket Server. Other Socket Server tutorials build upon +this tutorial. The Socket Server is also known as ESock. +
Connecting to the Socket Server

The RSocketServ class +provides the Connect() function to create a session to +the socket server.

+
Procedure

The steps to connect and then close a +session with the Socket Server are:

    +
  • Call one of the RSocketServ::Connect() functions. +

  • +
  • Perform socket operations

  • +
  • Call Close to end the session with the Socket Server +

  • +
+
ExampleRSocketServ ss; + +// Connect to ESOCK +ss.Connect(); + +// Perform operations on the socket server +... + +// Close the connection +ss.Close(); +
+
Further considerations

The RSocketServ::Connect() function +allows optional extra information to be sent to the Socket Server to change +the performance of the connection. Two optional parameters are available: +

    +
  1. Message Slots - If the client application expects to keep +a large number of requests open at the same time, then the client application +can increase the message slots available to the connection.

  2. +
  3. Protocol Preference - If the client application will use the +connection to interact with only one protocol, then this protocol should +be specified. The Socket Server uses the preferred protocol to improve the +efficiency of the messages between the client application and the protocol

  4. +
+

The RSocketServ connection +allows a number of sub-connections that +offer more functionality. The sub-connections available are:

    +
  • RConnection

  • +
  • RSubConnection

  • +
  • RSocket

  • +
  • RHostResolver

  • +
  • RNetDatabase

  • +

The purpose of each of these sub-connections is described in the +.

Procedure

The +procedure to attach any of these sub-connections is:

    +
  1. Create or use an existing RSocketServ session.

  2. +
  3. Call the Open() function +on the object for the sub-connection class. Pass into the Open() function +a reference to the RSocketServ session.

  4. +
  5. Perform sub-connection +operations

  6. +
  7. Call Close to +end the sub-session

  8. +

Example 1: Socket (RSocket)

RSocketServ ss; +RSocket sock; + +// Connect to the Sockets Server +ss.Connect(); + +// open a socket +sock.Open(ss); + +// Perform operations on the socket +... + +// Close the socket connection +sock.Close(); +

Example 2: Connection Management +(RConnection)

RSocketServ ss; +RConnection conn; + +// Connect to the Sockets Server +ss.Connect(); + +// Open the Connection Management sub-connection +conn.Open(ss); + +// Perform operations on the connection +... + +// Close the sub-connection and connection +ss.Close(); +

This example shows that you do not need to close sub-connections +explicitly. If you close the RSocketServ connection, the Comms Framework closes +all attached sub-connections.

+
+How to + Start and Close a Management Plane session: Tutorial + +Socket Server +Reference +
\ No newline at end of file