CEchoWrite
classAs you would expect, CEchoWrite
is similar to CEchoRead
: it wraps an asynchronous write socket call (RSocket::
Write()
) in an active object. The request is made by IssueWrite()
:
void CEchoWrite::IssueWrite(const TChar &aChar)
// Write character to a stream socket
{
iBuffer.SetLength(0);
iBuffer.Append(aChar);
iEchoSocket->Write(iBuffer, iStatus);
iTimer->After(iTimeOut);
SetActive();
iWriteStatus = ESending;
};
A one character buffer containing the character to write is passed to the RSocket::Write()
call. As with CEchoEngine::ConnectL()
, the function uses a time-out object to protect against excessive time waiting.
CEchoWrite::RunL()
is defined simply to check that no error occurred on the write operation.