开发者

Ruby Net::IMAP: closing a connection

开发者 https://www.devze.com 2023-01-08 21:04 出处:网络
Ruby Net::IMAP library provides a good API for IMAP stuff (http://railsapi.com/doc开发者_如何学Go/ruby-v1.8/classes/Net/IMAP.html). There are two methods related to closing the IMAP connection: logout

Ruby Net::IMAP library provides a good API for IMAP stuff (http://railsapi.com/doc开发者_如何学Go/ruby-v1.8/classes/Net/IMAP.html). There are two methods related to closing the IMAP connection: logout() and disconnect(). In which turn are they supposed to be called?


logout will simply log the user out of the server while disconnect will completely close the socket. I would use logout if you want to keep the connection open (like maybe logging into another mailbox using the same socket) and disconnect when you don't need to do anymore work with the IMAP server. As for a sequence, logout should be used before disconnect.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号