Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to write data

The following code fragment illustrates various urgent and packeted data sends on two sockets.

//
// Two sockets (sock1 and sock2) have already been opened...
//
_LIT8(KData,"some data...");

//
// URGENT WRITING TO SOCK1
//
sock1.Send(KData,KExpeditedDataOpt,stat1);//Writing data packet 0 to
User::WaitForRequest(stat1);              //socket 1.
                                          //stat1 should retn.KErrNone
//
// WRITING PACKET TO SOCK1
//
sock1.Write(KData,stat1);                 //Writing data packet 0 to 
User::WaitForRequest(stat1);              //socket 1.
                                          //stat1 should retn.KErrNone
//
// WRITING 10 PACKETS TO SOCKET 2
//
for (TUint i=0;i<10;i++)
 {
 sock2.Write(KData,stat1);            //Writing data packet 0 to 
 User::WaitForRequest(stat1);         //socket2 (ordinary send).
 }                                    //stat1 should retn.KErrNone

//
// URGENT WRITING TO SOCK2
//
sock1.Send(KData,KExpeditedDataOpt,stat1);//Writing data packet 0 to
User::WaitForRequest(stat1);              //socket 2 (urgent send!).
                                          //stat1 should retn.KErrNone