Hi;
 
  I am writing a proxy server for courier imap. It is still in the initial stage. I am getting a request from the mail client and i am passing it to the mail server (without any processing in between). and I am getting a response from the mail server and passing it to the mail client(without any processing in between).
     But during handshaking signals only iam getting problem. The mail client is not writing anything in the buffer and it is returning -1. I am enclosing the main part of the code and the output where it is getting struck.I printed the errno value that is also not set.
   If anybody has developed any proxy server for this imap. pls tell me what is going wrong.
 
 Thanking you
 
Mubashir ahmed.
 
// This is main part of the transaction.
for (;;)
{
  size = recv(serverSockDes, buf, sizeof buf, 0);
  send(newClientSockDes, buf, size, 0);
 
  buf[size] = '\0';
  oFileTrans << buf;
  puts(buf);
  size = 0;
  size = recv(newClientSockDes, buf, sizeof buf, 0);
  if (size < 0)
  {
   perror ("Cannot get Any data from the client\n");
   exit (-1);
  }
  
  send(serverSockDes, buf, size, 0);
  buf[size] = '\0';
  puts(buf);
}
 
// This is the output and mail client is returning -1 at the last, after the server responds "+ entering idle mode"
 
SERVER DATA
* OK Courier-IMAP ready. Copyright 1998-2003 Double Precision, Inc.  See COPYING for distribution information.

CLIENT DATA
002U CAPABILITY
 
SERVER DATA
* CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE STARTTLS
 
002U OK CAPABILITY completed
 
CLIENT DATA
002V LOGIN "cair" "eximsoftcair"
 
SERVER DATA
002V OK LOGIN Ok.
 
CLIENT DATA
002W IDLE
 
SERVER DATA
+ entering idle mode
 
CLIENT DATA
DONE
 
SERVER DATA
002W OK IDLE completed
 
CLIENT DATA
002X STATUS "INBOX" (MESSAGES UNSEEN)
 
SERVER DATA
* STATUS "INBOX" (MESSAGES 11 UNSEEN 1)
 
002X OK STATUS Completed.
 
CLIENT DATA
002Y IDLE
 
SERVER DATA
+ entering idle mode
 
CLIENT DATA   // mail client is returning -1 here.

Reply via email to