questions about how to do multiple IMAP sessions to the server in c-client
In RFC 3501, it defines "Connection" and "Session" as --- "Connection" refers to the entire sequence of client/server interaction from the initial establishment of the network connection until its termination. -- Could I compare it with login complete? -- "Session" refers to the sequence of client/server interaction from the time that a mailbox is selected (SELECT or EXAMINE command) until the time that selection ends (SELECT or EXAMINE of another mailbox, CLOSE command, or connection termination). -- It also says: --- Only one mailbox can be selected at a time in a connection; simultaneous access to multiple mailboxes requires multiple connections. --- If the IMAP client which uses c-client wants to show the list of mails from all of the mailboxes after login complete, then user could select the mail interested, does it mean that there must be multiple "connections" (multiple login's) in order to maintain multiple mailboxes to be SELECT'ed, so that the data in c-client's cache could be used later. Or it is the client's responsibility to cache the data besides the c-client's cache, and after user selects a mail entry then re-do SELECT for the interested mailbox, so that there is at most only one mailbox is open at all time? What is the suggested way to have access to multiple mailboxes using c-client. Thanks!
Re: questions about how to do multiple IMAP sessions to the server in c-client
On Thu, 28 Oct 2004 [EMAIL PROTECTED] wrote: "Connection" refers to the entire sequence of client/server interaction from the initial establishment of the network connection until its termination. Could I compare it with login complete? That's like saying "can I compare a drive in my car to starting the motor". The definitions of "connection" and "session" in RFC 3501 are fairly specific. I believe that any additional definitions would only make matters more complicated instead of less complicated If the IMAP client which uses c-client wants to show the list of mails from all of the mailboxes after login complete, then user could select the mail interested, does it mean that there must be multiple "connections" (multiple login's) in order to maintain multiple mailboxes to be SELECT'ed, so that the data in c-client's cache could be used later. Only one mailbox is SELECTed at a time, and c-client only caches data from the currently SELECTed mailbox. You can have multiple MAILSTREAMs open, each with a separate mailbox selected. It is your choice whether you want to do that or to go through each mailbox one-by-one. HOWEVER! It is an exceedingly poor idea for a client to attempt to list messages from all mailboxes. The list of mailboxes may be extremely long with long servers. You will run out of memory and disk space on your client long before you complete gathering the entire list. It is also a misuse of IMAP. The entire reason why IMAP has all these features to collect individual data items is so the client can access data on demand by the end user, and not have to download everything at startup. The best way to implement an IMAP client is to pretend that you have a basic DOS machine with 640K RAM, a 20MB hard drive, and a 2400bps modem; and to assume that the user has 10,000 mailboxes each with 100,000 messages and each message is 500K. You wouldn't even think of trying a mass download in such an environment. Instead, you would get only that data that is needed at that point in time. -- Mark -- http://staff.washington.edu/mrc Science does not emerge from voting, party politics, or public debate. Si vis pacem, para bellum.
Re: questions about how to do multiple IMAP sessions to the server in c-client
In a message dated 2004/10/28 12:44:49 Eastern Daylight Time, [EMAIL PROTECTED] writes: > "Connection" refers to the entire sequence of client/server interaction from> the initial establishment of the network connection until its termination.>> Could I compare it with login complete?That's like saying "can I compare a drive in my car to starting the motor". I agree the compassion is not appropriate. What I really want is to make sure that after log-ed in until logout, it is counted as in one connection. If this is true, then after login until logout there can only be one mailbox being selected (one session there). Regarding why thinking about keep multiple mailbox selected using c-client: > If the IMAP client which uses c-client wants to show the list of mails from> all of the mailboxes after login complete, then user could select the mail> interested, does it mean that there must be multiple "connections" (multiple> login's) in order to maintain multiple mailboxes to be SELECT'ed, so that the> data in c-client's cache could be used later.Only one mailbox is SELECTed at a time, and c-client only caches data from the currently SELECTed mailbox.You can have multiple MAILSTREAMs open, each with a separate mailbox selected. It is your choice whether you want to do that or to go through each mailbox one-by-one. "can have multiple MAILSTREAMs open, each with a separate mailbox selected", I believe you mean the mail boxes for the MAILSTREAMs might be SELECT'ed before and not closed, but only one is SELECT'ed at the moment. Also if the MAILSTREAM s1's mail box had been SELECT'ed before but now another mail box is SELECT'ed. Could we still call this MAILSTREAM s1 open until it is closed? Will the data downloaded into cache while it was open be still in the c-client cache, until s1 is closed even if other mail box is SELECT'ed now (i.e. can still use some of the mail_xxx() function against this stream s1, such as get msg number..)? HOWEVER!It is an exceedingly poor idea for a client to attempt to list messages from all mailboxes. The list of mailboxes may be extremely long with long servers. You will run out of memory and disk space on your client long before you complete gathering the entire list.It is also a misuse of IMAP. The entire reason why IMAP has all these features to collect individual data items is so the client can access data on demand by the end user, and not have to download everything at startup. Totally agree your comment on thinking about the resource limitation issue. I saw some of the commercial IMAP client(e.g. Communicator), one of basic feature is to list all of the mail entries (sender, subject, time) from different mailbox after log into the server. Then user could brows around, doing a quick local search to see if there is mail from someone or have certain subject, and then click on the interested mail from different mailboxes(I used to call it folders). If the mailbox is not selected at clicking time then it will have to be re-selected at the clicking time. From the nature of IMAP I guess your suggestion is to prefer to reselect than to keep multiple mailbox SELETC'ed in multiple connections. But we still have problem if the client really want get the 10,000 mails to be listed in UI after login. It might take a while on dial up connection Again, thanks for your response and it is really great help!
Re: questions about how to do multiple IMAP sessions to the server in c-client
I strongly suggest that you buy a copy of the book "Internet Email Protocols: A Developer's Guide", by Kevin Johnson, published by Addison Wesley, ISBN 0-201-43288-9. Your questions indicate a very basic misunderstanding of the IMAP protocol. Until that misunderstanding is clarified, you are going to have a very long and frustrating experience. On Thu, 28 Oct 2004 [EMAIL PROTECTED] wrote: What I really want is to make sure that after log-ed in until logout, it is counted as in one connection. It's one connection from the point that the initial TCP interchange is made (even before authenticated). If this is true, then after login until logout there can only be one mailbox being selected (one session there). There can only be one mailbox selected at a time. If you select mailbox2 while mailbox1 is selected, then mailbox1 is automatically unselected and mailbox2 is now selected. This forms a new session within the same connection. "can have multiple MAILSTREAMs open, each with a separate mailbox selected", I believe you mean the mail boxes for the MAILSTREAMs might be SELECT'ed before and not closed, but only one is SELECT'ed at the moment. No. I mean that you can have multiple connections, each with a different mailbox SELECTed. This is the only way that you can have more than one mailbox SELECTed at a time. Also if the MAILSTREAM s1's mail box had been SELECT'ed before but now another mail box is SELECT'ed. Could we still call this MAILSTREAM s1 open until it is closed? Any existing MAILSTREAM is not affected by opening a new MAILSTREAM. Each MAILSTREAM is completely independent of any other MAILSTREAMs. By passing a non-null MAILSTREAM to mail_open(), you can do a new SELECT on a MAILSTREAM, without closing the connection. Will the data downloaded into cache while it was open be still in the c-client cache, until s1 is closed even if other mail box is SELECT'ed now (i.e. can still use some of the mail_xxx() function against this stream s1, such as get msg number..)? Each MAILSTREAM has its own cache. The cache is destroyed when the MAILSTREAM is closed, or if the MAILSTREAM is passed to mail_open() to SELECT a new mailbox. -- Mark -- http://staff.washington.edu/mrc Science does not emerge from voting, party politics, or public debate. Si vis pacem, para bellum.