PRUint32 count; rv = mStream->GetLength(&count); rv = mTransport->AsyncWrite(mStream, 0, count, mTransport, gEventQ,  nsnull);
rv = mTransport->AsyncWrite(mStream, 0, bytesWritten, mTransport, gEventQ,  nsnull);
nsresult TestConnection::WriteBuffer(void){  nsresult rv;  char *buffer;  PRInt32 size;  PRUint32 bytesWritten;  printf("\n+++ Request is: %c.  Context = %p\n", mBufferChar, mTransport);  // Create and fill a test buffer of data...  buffer = (char*)PR_Malloc(mBufferLength + 4);  if (buffer) {    for (size=0; size<mBufferLength-2; size++) {      buffer[size] = mBufferChar;    }    buffer[size++] = '\r';    buffer[size++] = '\n';    buffer[size]   = 0;    //    // Async case...    //    if (mStream) {      rv = mStream->Fill(buffer, size, &bytesWritten);      // Write the buffer to the server...      if (NS_SUCCEEDED(rv)) {        PRUint32 count;        rv = mStream->GetLength(&count);        rv = mTransport->AsyncWrite(mStream, 0, count, mTransport, gEventQ, /* mOutputObserver */ nsnull);      }       // Wait for the write to complete...      if (NS_SUCCEEDED(rv)) {        Wait();      } else {        printf("Error: AsyncWrite failed...");      }    }     //    // Synchronous case...    //    else if (mOutStream) {      rv = mOutStream->Write(buffer, size, &bytesWritten);    }    PR_Free(buffer);  } else {    rv = NS_ERROR_OUT_OF_MEMORY;  }  return rv;}