void SMTPClientSession::login(const std::string& hostname, std::string& response) { open(); int status = sendCommand("EHLO", hostname, response); if (isPermanentNegative(status)) status = sendCommand("HELO", hostname, response); if (!isPositiveCompletion(status)) throw SMTPException("Login failed", response, status); }
bool FTPClientSession::sendEPSV(SocketAddress& addr) { std::string response; int status = sendCommand("EPSV", response); if (isPositiveCompletion(status)) { parseExtAddress(response, addr); return true; } else if (isPermanentNegative(status)) { return false; } else throw FTPException("EPSV command failed", response, status); }
bool FTPClientSession::sendEPRT(const SocketAddress& addr) { std::string arg("|"); arg += addr.af() == AF_INET ? '1' : '2'; arg += '|'; arg += addr.host().toString(); arg += '|'; arg += NumberFormatter::format(addr.port()); arg += '|'; std::string response; int status = sendCommand("EPRT", arg, response); if (isPositiveCompletion(status)) return true; else if (isPermanentNegative(status)) return false; else throw FTPException("EPRT command failed", response, status); }