I'm writing an application by symbian OS using c++ , this application using sockets to access a pop3 mail server On this issue I have a question:

I have a problem with the (PASS) command to be authenticated , I'm using 8-bit character method for sending the command through socket when I tried to send the user it said: (+OK Name Is valid mailbox) , and when I send the password it said-ERR Authentication faild) , here is the code for sending pass command:

_LIT8(KpassFormat,"PASS %s\r\n");
TBuf8<20> bufPass;
TBuf8<15> m_sPassword;
_LIT8(Password,"XXXX");
m_sPassword.Copy(Password);//_L("XXXX"));
bufPass.Format(KpassFormat,m_sPassword.Ptr());

When I display the value of the (Bufpass) it is like this: "PASS XXXX "
As you know the last two digits is for (Carrage ruturn) which means (11) digits ((9 for the command+2 for (cr))

So from the above description what could be the problem?


I Test It from telnet , every things work fine and in progress which means that the problem comes from my code ,
Here is a snippest of my code after another modification:


//------------->Original
_LIT(KpassFormat,"PASS XXXX\r\n");
TBuf8<40> bufPass8;
bufPass8.Copy(KpassFormat);
iSocketsEngine->WriteL(bufPass8);
//SendNumMessages();

When I trace the value of (bufPass8) the lingth of it is (11) digits (True) as the following :

(4) Digits for the word (PASS) + 1 (Space) + (4) Digits For the password (XXXX) + (1) Digit (cr) + (1) Digit New Line=11

Each digit represinted by it's ASCII code number and the Lette sample e.g.:
Digit [0] 80 'P'
Digit [1] 65 'A'
etc,..
Digit [9] 13 'cr'
Digit [10] 10 'nl'

That Means every thing is correct , in representing the letters the Login Id message is:
(+OK Name Is valid mailbox) like telnet
When I enter the pass command it says :
(-ERR Authentication faild) , Is Tahere any mistake in my code ? what I should do? I test it from my mobile , the connect to server is correct and the user id is correct but the password is wrong , the same procedure that I did it with password I did it wiht user id ?

I did also another modification ike this:
_LIT(KpassFormat,"PASS XXXX\r\n");
TBuf8<40> bufPass8;
bufPass8.Copy(KpassFormat);
HBufC8* bert = bufPass8.AllocL();//TT.AllocL();
//iSocketsEngine->WriteL(bufPass8);
iSocketsEngine->WriteL(*bert);

//----->For User Id Somtimes it is not respondig to my request
_LIT(KuserFormat,"USER mub@XXX.com.au\r\n");
TBuf8<40> BufUser8;//40 Is The original
BufUser8.Copy(KuserFormat);//
//------------------->
HBufC8* bert = BufUser8.AllocL();//TT.AllocL();
iSocketsEngine->WriteL(*bert);