FTP 221 reply for USER cmd - VMS

This is a discussion on FTP 221 reply for USER cmd - VMS ; Hi All, We have written a FTP client code. using which we are trying to ftp to a server and transfer a file. First i am connecting to the server, by creating a new socket, then making it a reusable ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: FTP 221 reply for USER cmd

  1. FTP 221 reply for USER cmd

    Hi All,

    We have written a FTP client code. using which we are trying to
    ftp to a server and transfer a file.
    First i am connecting to the server, by creating a new socket, then
    making it a reusable socket then connect using default FTP port.
    I am able to connect to the FTP server, and i get a reply "220 moon
    FTP server (SunOS 5.8) ready."

    Then i try to authenticate by sending USER command. The command i am
    sending is "USER ipbss\r\n"
    To this command i am getting a reply as "221 You could at least say
    goodbye."
    I am not getting 331 reply.

    I am not able to understand why FTP server is sending me 221 error code
    instead of 331.


    Here is my authenticate part of code.

    strcpy(mCmd, "USER ipbss\r\n");
    mObjFtpSocket.Send(mCmd, strlen(mCmd));
    if (GetReply() != 331)
    {
    emtLog << l_ERROR <<
    "CFTP::Authenticate : Authentication failed, as
    error code returned is not 331..possible connection lost"
    << endl;
    return false;
    }

    SetCommand("PASS ", Password);
    mObjFtpSocket.Send(mCmd, strlen(mCmd));
    if (GetReply() != LOGIN_SUCCESSFULL)
    {
    emtLog << l_ERROR << "get reply is not success" <<
    endl;
    return false;
    }



    here i have also added the getReply() where i wait for a response after
    sending any command and extracting the reply code from the response

    int CFTP::GetReply(int Flag)
    {//here Flag is 0
    static char Tmp[4];
    int Len = 0, Index = 0;
    char *p = NULL;

    do
    {
    memset(mResult, 0, MAX_FTPRESULT_LEN);
    Index = 0;
    while (1)
    {
    Len = mObjFtpSocket.Recv(&mResult[Index], 100,
    Flag);
    Index += Len;
    if (mResult[Index - 2] == 13 && mResult[Index -
    1] == 10)
    {
    break;
    }
    }

    mResult[Index - 2] = '\0';

    p = strrchr(mResult, '\n');
    if (p == NULL)
    {
    p = mResult;
    }
    else
    {
    p++;
    }

    if (*(p + 3) == '-')
    {
    continue;
    }
    else
    {
    break;
    }
    } while (1);

    strncpy(Tmp, p, 3);
    Tmp[3] = '\0';

    int RetCode = atoi(Tmp);
    return RetCode;
    }

    This FTP is working in my office. But in my clients place, its giving
    me this problem.
    Please let me know if any one knows what the problem may be. Any
    configuration needs to be changed ??
    Please let me know it is very urgent.

    Regards,
    Deepthi. K.V


  2. Re: FTP 221 reply for USER cmd

    I think youve got your widgets, wotsits and doodads mixed up. If you replace
    the 4th line in your code with a watchamacallit you'll be fine.

    What the hell is this being posted to alt.guitar for?


    wrote in message
    news:1143027617.120991.43900@u72g2000cwu.googlegro ups.com...
    > Hi All,
    >
    > We have written a FTP client code. using which we are trying to
    > ftp to a server and transfer a file.
    > First i am connecting to the server, by creating a new socket, then
    > making it a reusable socket then connect using default FTP port.
    > I am able to connect to the FTP server, and i get a reply "220 moon
    > FTP server (SunOS 5.8) ready."
    >
    > Then i try to authenticate by sending USER command. The command i am
    > sending is "USER ipbss\r\n"
    > To this command i am getting a reply as "221 You could at least say
    > goodbye."
    > I am not getting 331 reply.
    >
    > I am not able to understand why FTP server is sending me 221 error code
    > instead of 331.
    >
    >
    > Here is my authenticate part of code.
    >
    > strcpy(mCmd, "USER ipbss\r\n");
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != 331)
    > {
    > emtLog << l_ERROR <<
    > "CFTP::Authenticate : Authentication failed, as
    > error code returned is not 331..possible connection lost"
    > << endl;
    > return false;
    > }
    >
    > SetCommand("PASS ", Password);
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != LOGIN_SUCCESSFULL)
    > {
    > emtLog << l_ERROR << "get reply is not success" <<
    > endl;
    > return false;
    > }
    >
    >
    >
    > here i have also added the getReply() where i wait for a response after
    > sending any command and extracting the reply code from the response
    >
    > int CFTP::GetReply(int Flag)
    > {//here Flag is 0
    > static char Tmp[4];
    > int Len = 0, Index = 0;
    > char *p = NULL;
    >
    > do
    > {
    > memset(mResult, 0, MAX_FTPRESULT_LEN);
    > Index = 0;
    > while (1)
    > {
    > Len = mObjFtpSocket.Recv(&mResult[Index], 100,
    > Flag);
    > Index += Len;
    > if (mResult[Index - 2] == 13 && mResult[Index -
    > 1] == 10)
    > {
    > break;
    > }
    > }
    >
    > mResult[Index - 2] = '\0';
    >
    > p = strrchr(mResult, '\n');
    > if (p == NULL)
    > {
    > p = mResult;
    > }
    > else
    > {
    > p++;
    > }
    >
    > if (*(p + 3) == '-')
    > {
    > continue;
    > }
    > else
    > {
    > break;
    > }
    > } while (1);
    >
    > strncpy(Tmp, p, 3);
    > Tmp[3] = '\0';
    >
    > int RetCode = atoi(Tmp);
    > return RetCode;
    > }
    >
    > This FTP is working in my office. But in my clients place, its giving
    > me this problem.
    > Please let me know if any one knows what the problem may be. Any
    > configuration needs to be changed ??
    > Please let me know it is very urgent.
    >
    > Regards,
    > Deepthi. K.V
    >




  3. Re: FTP 221 reply for USER cmd


    deepthi.kallahakalla@lntinfotech.com wrote:
    > Hi All,
    >
    > We have written a FTP client code. using which we are trying to
    > ftp to a server and transfer a file.
    > First i am connecting to the server, by creating a new socket, then
    > making it a reusable socket then connect using default FTP port.
    > I am able to connect to the FTP server, and i get a reply "220 moon
    > FTP server (SunOS 5.8) ready."
    >
    > Then i try to authenticate by sending USER command. The command i am
    > sending is "USER ipbss\r\n"
    > To this command i am getting a reply as "221 You could at least say
    > goodbye."
    > I am not getting 331 reply.
    >
    > I am not able to understand why FTP server is sending me 221 error code
    > instead of 331.
    >
    >
    > Here is my authenticate part of code.
    >
    > strcpy(mCmd, "USER ipbss\r\n");
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != 331)
    > {
    > emtLog << l_ERROR <<
    > "CFTP::Authenticate : Authentication failed, as
    > error code returned is not 331..possible connection lost"
    > << endl;
    > return false;
    > }
    >
    > SetCommand("PASS ", Password);
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != LOGIN_SUCCESSFULL)
    > {
    > emtLog << l_ERROR << "get reply is not success" <<
    > endl;
    > return false;
    > }
    >
    >
    >
    > here i have also added the getReply() where i wait for a response after
    > sending any command and extracting the reply code from the response
    >
    > int CFTP::GetReply(int Flag)
    > {//here Flag is 0
    > static char Tmp[4];
    > int Len = 0, Index = 0;
    > char *p = NULL;
    >
    > do
    > {
    > memset(mResult, 0, MAX_FTPRESULT_LEN);
    > Index = 0;
    > while (1)
    > {
    > Len = mObjFtpSocket.Recv(&mResult[Index], 100,
    > Flag);
    > Index += Len;
    > if (mResult[Index - 2] == 13 && mResult[Index -
    > 1] == 10)
    > {
    > break;
    > }
    > }
    >
    > mResult[Index - 2] = '\0';
    >
    > p = strrchr(mResult, '\n');
    > if (p == NULL)
    > {
    > p = mResult;
    > }
    > else
    > {
    > p++;
    > }
    >
    > if (*(p + 3) == '-')
    > {
    > continue;
    > }
    > else
    > {
    > break;
    > }
    > } while (1);
    >
    > strncpy(Tmp, p, 3);
    > Tmp[3] = '\0';
    >
    > int RetCode = atoi(Tmp);
    > return RetCode;
    > }
    >
    > This FTP is working in my office. But in my clients place, its giving
    > me this problem.
    > Please let me know if any one knows what the problem may be. Any
    > configuration needs to be changed ??
    > Please let me know it is very urgent.
    >
    > Regards,
    > Deepthi. K.V



    Digital isn't quite there yet; if you want good tone, build it with
    vacuum tubes. For the RetCode, I would use a 5U4G instead of the atoi.


  4. Re: FTP 221 reply for USER cmd

    deepthi.kallahakalla@lntinfotech.com wrote:
    > Hi All,
    >
    > We have written a FTP client code. using which we are trying to
    > ftp to a server and transfer a file.
    > First i am connecting to the server, by creating a new socket, then
    > making it a reusable socket then connect using default FTP port.
    > I am able to connect to the FTP server, and i get a reply "220 moon
    > FTP server (SunOS 5.8) ready."
    >
    > Then i try to authenticate by sending USER command. The command i am
    > sending is "USER ipbss\r\n"
    > To this command i am getting a reply as "221 You could at least say
    > goodbye."
    > I am not getting 331 reply.
    >
    > I am not able to understand why FTP server is sending me 221 error code
    > instead of 331.
    >
    >
    > Here is my authenticate part of code.
    >
    > strcpy(mCmd, "USER ipbss\r\n");
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != 331)
    > {
    > emtLog << l_ERROR <<
    > "CFTP::Authenticate : Authentication failed, as
    > error code returned is not 331..possible connection lost"
    > << endl;
    > return false;
    > }
    >
    > SetCommand("PASS ", Password);
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != LOGIN_SUCCESSFULL)
    > {
    > emtLog << l_ERROR << "get reply is not success" <<
    > endl;
    > return false;
    > }
    >
    >
    >
    > here i have also added the getReply() where i wait for a response after
    > sending any command and extracting the reply code from the response
    >
    > int CFTP::GetReply(int Flag)
    > {//here Flag is 0
    > static char Tmp[4];
    > int Len = 0, Index = 0;
    > char *p = NULL;
    >
    > do
    > {
    > memset(mResult, 0, MAX_FTPRESULT_LEN);
    > Index = 0;
    > while (1)
    > {
    > Len = mObjFtpSocket.Recv(&mResult[Index], 100,
    > Flag);
    > Index += Len;
    > if (mResult[Index - 2] == 13 && mResult[Index -
    > 1] == 10)
    > {
    > break;
    > }
    > }
    >
    > mResult[Index - 2] = '\0';
    >
    > p = strrchr(mResult, '\n');
    > if (p == NULL)
    > {
    > p = mResult;
    > }
    > else
    > {
    > p++;
    > }
    >
    > if (*(p + 3) == '-')
    > {
    > continue;
    > }
    > else
    > {
    > break;
    > }
    > } while (1);
    >
    > strncpy(Tmp, p, 3);
    > Tmp[3] = '\0';
    >
    > int RetCode = atoi(Tmp);
    > return RetCode;
    > }
    >
    > This FTP is working in my office. But in my clients place, its giving
    > me this problem.
    > Please let me know if any one knows what the problem may be. Any
    > configuration needs to be changed ??
    > Please let me know it is very urgent.
    >
    > Regards,
    > Deepthi. K.V
    >


    I would suggest that before delving into writing FTP client code, that
    you learn the basics like:

    turning your computer on and off

    Microsoft office basics

    Windows for dummies

    and...

    *how to use a newsreader client*.

    HTH,

    Andy.


  5. Re: FTP 221 reply for USER cmd

    If you can answer to the question....reply...
    dont wate your time writting some rubbish...
    No one is great in this world...


  6. Re: FTP 221 reply for USER cmd

    In article <1143104544.647365.272670@i40g2000cwc.googlegroups. com>, "deepthi.kallahakalla@lntinfotech.com" writes:
    > If you can answer to the question....reply...
    > dont wate your time writting some rubbish...
    > No one is great in this world...


    Rule of thumb...

    If you ask for free advice about a TCP/IP problem and accidentally
    cross-post to alt.guitar, you'll probably get better results by
    apologizing for your error rather than by sending a complaint that
    the folks on alt.guitar will never see.

    If it were me, I'd be thinking about getting a packet capture so that
    I could see why the server thought a 331 response was appropriate.
    And then I'd be looking at my code to see why I was generating the
    output that made that response appropriate.

    If you get deep enough into a problem that you're posting code for other
    people to analyze, chances are the code isn't doing what you think it's
    doing and it's a good idea to try to see what it actually is doing.

  7. Re: FTP 221 reply for USER cmd

    I think your server needs a Neck adjustment. Try tightening the truss-rod
    1/4 turn.

    -Larry

    wrote in message
    news:1143027617.120991.43900@u72g2000cwu.googlegro ups.com...
    > Hi All,
    >
    > We have written a FTP client code. using which we are trying to
    > ftp to a server and transfer a file.
    > First i am connecting to the server, by creating a new socket, then
    > making it a reusable socket then connect using default FTP port.
    > I am able to connect to the FTP server, and i get a reply "220 moon
    > FTP server (SunOS 5.8) ready."
    >
    > Then i try to authenticate by sending USER command. The command i am
    > sending is "USER ipbss\r\n"
    > To this command i am getting a reply as "221 You could at least say
    > goodbye."
    > I am not getting 331 reply.
    >
    > I am not able to understand why FTP server is sending me 221 error code
    > instead of 331.
    >
    >
    > Here is my authenticate part of code.
    >
    > strcpy(mCmd, "USER ipbss\r\n");
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != 331)
    > {
    > emtLog << l_ERROR <<
    > "CFTP::Authenticate : Authentication failed, as
    > error code returned is not 331..possible connection lost"
    > << endl;
    > return false;
    > }
    >
    > SetCommand("PASS ", Password);
    > mObjFtpSocket.Send(mCmd, strlen(mCmd));
    > if (GetReply() != LOGIN_SUCCESSFULL)
    > {
    > emtLog << l_ERROR << "get reply is not success" <<
    > endl;
    > return false;
    > }
    >
    >
    >
    > here i have also added the getReply() where i wait for a response after
    > sending any command and extracting the reply code from the response
    >
    > int CFTP::GetReply(int Flag)
    > {//here Flag is 0
    > static char Tmp[4];
    > int Len = 0, Index = 0;
    > char *p = NULL;
    >
    > do
    > {
    > memset(mResult, 0, MAX_FTPRESULT_LEN);
    > Index = 0;
    > while (1)
    > {
    > Len = mObjFtpSocket.Recv(&mResult[Index], 100,
    > Flag);
    > Index += Len;
    > if (mResult[Index - 2] == 13 && mResult[Index -
    > 1] == 10)
    > {
    > break;
    > }
    > }
    >
    > mResult[Index - 2] = '\0';
    >
    > p = strrchr(mResult, '\n');
    > if (p == NULL)
    > {
    > p = mResult;
    > }
    > else
    > {
    > p++;
    > }
    >
    > if (*(p + 3) == '-')
    > {
    > continue;
    > }
    > else
    > {
    > break;
    > }
    > } while (1);
    >
    > strncpy(Tmp, p, 3);
    > Tmp[3] = '\0';
    >
    > int RetCode = atoi(Tmp);
    > return RetCode;
    > }
    >
    > This FTP is working in my office. But in my clients place, its giving
    > me this problem.
    > Please let me know if any one knows what the problem may be. Any
    > configuration needs to be changed ??
    > Please let me know it is very urgent.
    >
    > Regards,
    > Deepthi. K.V
    >




+ Reply to Thread