Checking for closed/broken connections

Alwin <[email protected]>
Newsgroups gmane.mail.libetpan.user
Message-ID <[email protected]>
Hi,

I've big problem with unstable network links and libetpan. Eg., how can I 
check if a connection is closed/broken when ein try to make a command?

Well, I hold the connection as long as possible and don't make a login on 
every command 'cause this would be a little bit senseless.

So I tried:

    if (m_imap) {
        err = mailimap_noop(m_imap);
        if (err!=MAILIMAP_NO_ERROR) {
	    err = mailimap_close( m_imap );
	    mailimap_free( m_imap );
	    m_imap = 0;
        } else {
            mailstream_flush(m_imap->imap_stream);
            return;
        }
    }

I thought it would be the best in the first step, but sometimes I get a 
runtime at this point. 

So, what is the best way to check the connection for sending a new command? 
may be, that I didn't see it in the documentation... 

Bye




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.