Logo Search packages:      
Sourcecode: pwlib version File versions

BOOL PInternetProtocol::ReadCommand ( PINDEX &  num,
PString args 
) [virtual, inherited]

Read a single line of a command which ends with a CR/LF pair. The command number for the command name is parsed from the input, then the remaining text on the line is returned in the args parameter.

If the command does not match any of the command names then the entire line is placed in the args parameter and a value of P_MAX_INDEX is returned.

Note this function will block for the time specified by the PChannel::SetReadTimeout() function.

This function is typically used by server forms of the socket.

TRUE if something was read, otherwise an I/O error occurred.
num  Number of the command parsed from the command line, or P_MAX_INDEX if no match.
args  String to receive the arguments to the command.

Definition at line 555 of file inetprot.cxx.

References PString::Find(), PString::GetLength(), PString::IsEmpty(), PString::Left(), PString::Mid(), and PInternetProtocol::ReadLine().

Referenced by PPOP3Server::ProcessCommand(), ProcessCommand(), and PFTPServer::ProcessCommand().

  do {
    if (!ReadLine(args))
      return FALSE;
  } while (args.IsEmpty());

  PINDEX endCommand = args.Find(' ');
  if (endCommand == P_MAX_INDEX)
    endCommand = args.GetLength();
  PCaselessString cmd = args.Left(endCommand);

  num = commandNames.GetValuesIndex(cmd);
  if (num != P_MAX_INDEX)
    args = args.Mid(endCommand+1);

  return TRUE;

Generated by  Doxygen 1.6.0   Back to index