On November 4, 2008 08:14:51 pm Florent Blanchon wrote: > Hello, > > I'm programming an application to know the number of Unread Mail in my > Gmail Account. > It use openssl for the ssl protocol > > below are the lines code when I want to communicate : > > SSL_read(SSL_fd,buf1,200);i = sprintf(buf, "USER %s\n", login); > SSL_write(SSL_fd,buf,i);Sleep(100); > SSL_read(SSL_fd,buf2,200);i = sprintf(buf, "PASS %s\n", pass); > SSL_write(SSL_fd,buf,i);Sleep(100); > SSL_read(SSL_fd,buf3,200);i = sprintf(buf, "STAT\n"); > SSL_write(SSL_fd,buf,i);Sleep(100); > SSL_read(SSL_fd,buf3,200);i = sprintf(buf, "QUIT\n"); > SSL_write(SSL_fd,buf,i);Sleep(100); > > it send well the login it returns a request for password but after I don't > get an answer when sending password.... > > I hope someone could help me. > First of all, take a look using select instead of sleep - as a matter of fact, I think the sleeps are redundant (although it's been a long time since I did low level socket programming, so someone else can correct me if I am incorrect), unless you have set the sockets to non-blocking - in which case you REALLY should be using select(). Also, you have to check the return codes for SSL_read and SSL_write, since they may say that you need to write or read again (remember, there is an entire layer happening between the cleartext and the TCP session, and SSL_read and SSL_write, which may or may not want to follow your simple in/out regime above). Also, what does the server say when you use s_client and do all of that on the command line? You're not actually checking in the above if the USER returned OK, and you might want to do that, because the problem could be as simple as the other end hanging up when you don't give a correct USER.)
Have fun. -- Patrick Patterson President and Chief PKI Architect, Carillon Information Security Inc. http://www.carillon.ca ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]